Commit cf4adddb authored by Alexey Kozyatinskiy's avatar Alexey Kozyatinskiy Committed by Commit Bot

[inspector] forEachSession iterates in predictable order

protocol::HashMap(std::unordered_map)::iterator doesn't provide any
guarantees about iteration order. At least Visual C++ from vS 2015 and
clang compile for loop inside forEachSession differently.
For tests we need stable order of iteration, so let's use std::map
instead.

R=dgozman@chromium.org

Bug: none
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I329cb24cd182baa86c0ea4a526257856718f32b1
Reviewed-on: https://chromium-review.googlesource.com/609489Reviewed-by: 's avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47281}
parent 1ca0eea2
......@@ -32,6 +32,7 @@
#define V8_INSPECTOR_V8INSPECTORIMPL_H_
#include <functional>
#include <map>
#include "src/base/macros.h"
#include "src/inspector/protocol/Protocol.h"
......@@ -134,8 +135,7 @@ class V8InspectorImpl : public V8Inspector {
ContextsByGroupMap m_contexts;
// contextGroupId -> sessionId -> session
protocol::HashMap<int, protocol::HashMap<int, V8InspectorSessionImpl*>>
m_sessions;
protocol::HashMap<int, std::map<int, V8InspectorSessionImpl*>> m_sessions;
using ConsoleStorageMap =
protocol::HashMap<int, std::unique_ptr<V8ConsoleMessageStorage>>;
......
......@@ -7,11 +7,13 @@
'./console/',
'./cpu-profiler/',
'./debugger/',
'./heap-profiler/',
'./inspector.status',
'./json-parse-expected.txt',
'./json-parse.js',
'./protocol-test.js',
'./runtime/',
'./sessions/',
'./testcfg.py',
'../../src/inspector/injected-script-source.js',
'<(PRODUCT_DIR)/inspector-test<(EXECUTABLE_SUFFIX)',
......
......@@ -154,7 +154,7 @@ InspectorTest.ContextGroup = class {
InspectorTest.log('WARNING: setupInjectedScriptEnvironment with debug flag for debugging only and should not be landed.');
InspectorTest.log('WARNING: run test with --expose-inspector-scripts flag to get more details.');
InspectorTest.log('WARNING: you can additionally comment rjsmin in xxd.py to get unminified injected-script-source.js.');
var session = InspectorTest._sessions.next().vale;
var session = InspectorTest._sessions.next().value;
session.setupScriptMap();
sesison.Protocol.Debugger.enable();
session.Protocol.Debugger.onPaused(message => {
......
......@@ -60,7 +60,7 @@ From session 3
}
}
Destroying and creating context
From session 3
From session 2
{
method : Runtime.executionContextDestroyed
params : {
......@@ -76,7 +76,7 @@ From session 1
}
}
id matching: true
From session 2
From session 3
{
method : Runtime.executionContextDestroyed
params : {
......@@ -84,7 +84,7 @@ From session 2
}
}
id matching: true
From session 3
From session 2
{
method : Runtime.executionContextCreated
params : {
......@@ -106,7 +106,7 @@ From session 1
}
}
}
From session 2
From session 3
{
method : Runtime.executionContextCreated
params : {
......
......@@ -2,170 +2,170 @@ Tests how multiple sessions interact while pausing, stepping, setting breakpoint
Setting breakpoints in 1
Setting breakpoints in 2
Evaluating common breakpoint in 1
Paused in 2:
Paused in 1:
reason: other
hit breakpoints: test.js:11:0
location: foo@11
data: null
Paused in 1:
Paused in 2:
reason: other
hit breakpoints: test.js:11:0
location: foo@11
data: null
Resuming in 1
Resumed in 2
Resumed in 1
Resumed in 2
Evaluating debugger in 1
Paused in 2:
Paused in 1:
reason: other
hit breakpoints:
location: bar@25
data: null
Paused in 1:
Paused in 2:
reason: other
hit breakpoints:
location: bar@25
data: null
Resuming in 2
Resumed in 2
Resumed in 1
Resumed in 2
Evaluating exclusive breakpoint in 1
Paused in 2:
Paused in 1:
reason: other
hit breakpoints:
hit breakpoints: test.js:14:0
location: baz@14
data: null
Paused in 1:
Paused in 2:
reason: other
hit breakpoints: test.js:14:0
hit breakpoints:
location: baz@14
data: null
Resuming in 1
Resumed in 2
Resumed in 1
Resumed in 2
Evaluating common breakpoint in 2
Paused in 2:
Paused in 1:
reason: other
hit breakpoints: test.js:11:0
location: foo@11
data: null
Paused in 1:
Paused in 2:
reason: other
hit breakpoints: test.js:11:0
location: foo@11
data: null
Resuming in 2
Resumed in 2
Resumed in 1
Resumed in 2
Evaluating debugger in 2
Paused in 2:
Paused in 1:
reason: other
hit breakpoints:
location: bar@25
data: null
Paused in 1:
Paused in 2:
reason: other
hit breakpoints:
location: bar@25
data: null
Resuming in 2
Resumed in 2
Resumed in 1
Resumed in 2
Evaluating exclusive breakpoint in 2
Paused in 2:
Paused in 1:
reason: other
hit breakpoints:
hit breakpoints: test.js:14:0
location: baz@14
data: null
Paused in 1:
Paused in 2:
reason: other
hit breakpoints: test.js:14:0
hit breakpoints:
location: baz@14
data: null
Resuming in 1
Resumed in 2
Resumed in 1
Resumed in 2
Evaluating stepping in 1
Paused in 2:
Paused in 1:
reason: other
hit breakpoints:
location: stepping@17
data: null
Paused in 1:
Paused in 2:
reason: other
hit breakpoints:
location: stepping@17
data: null
Stepping into in 2
Resumed in 2
Resumed in 1
Paused in 2:
Resumed in 2
Paused in 1:
reason: other
hit breakpoints:
location: stepping@18
data: null
Paused in 1:
Paused in 2:
reason: other
hit breakpoints:
location: stepping@18
data: null
Stepping over in 1
Resumed in 2
Resumed in 1
Paused in 2:
Resumed in 2
Paused in 1:
reason: other
hit breakpoints:
location: stepping@19
data: null
Paused in 1:
Paused in 2:
reason: other
hit breakpoints:
location: stepping@19
data: null
Stepping out in 2
Resumed in 2
Resumed in 1
Paused in 2:
Resumed in 2
Paused in 1:
reason: other
hit breakpoints:
location: <anonymous>@0
data: null
Paused in 1:
Paused in 2:
reason: other
hit breakpoints:
location: <anonymous>@0
data: null
Resuming in 1
Resumed in 2
Resumed in 1
Resumed in 2
Pausing in next statement
Paused in 2:
Paused in 1:
reason: some-reason
hit breakpoints:
location: <anonymous>@0
data: {"a":42}
Paused in 1:
Paused in 2:
reason: some-reason
hit breakpoints:
location: <anonymous>@0
data: {"a":42}
Resuming in 1
Resumed in 2
Resumed in 1
Resumed in 2
Pausing in next statement
Paused in 2:
Paused in 1:
reason: some-reason
hit breakpoints:
location: <anonymous>@0
data: {"a":42}
Paused in 1:
Paused in 2:
reason: some-reason
hit breakpoints:
location: <anonymous>@0
data: {"a":42}
Resuming in 2
Resumed in 2
Resumed in 1
Resumed in 2
Blackboxing bar() in 2
Evaluating bar() in 2
Paused in 1:
......
Tests that multiple sessions pause once on console.assert.
Pausing on exceptions in 1
Asserting in 1
Paused in 2 with reason assert
Paused in 1 with reason assert
Asserting in 2
Paused in 2 with reason assert
Asserting in 2
Paused in 1 with reason assert
Paused in 2 with reason assert
Pausing on exceptions in both
Asserting in 1
Paused in 2 with reason assert
Paused in 1 with reason assert
Asserting in 2
Paused in 2 with reason assert
Asserting in 2
Paused in 1 with reason assert
Paused in 2 with reason assert
Not pausing on exceptions
Asserting in 1
Asserting in 2
......@@ -20,5 +20,5 @@ Pausing on exceptions in 3 (different context group)
Asserting in 3
Paused in 3 with reason assert
Asserting in 1
Paused in 2 with reason assert
Paused in 1 with reason assert
Paused in 2 with reason assert
Tests that all sessions get console api notifications.
Error in 2
From session 2
From session 1
{
method : Runtime.consoleAPICalled
params : {
......@@ -27,7 +27,7 @@ From session 2
type : error
}
}
From session 1
From session 2
{
method : Runtime.consoleAPICalled
params : {
......@@ -55,7 +55,7 @@ From session 1
}
}
Logging in 1
From session 2
From session 1
{
method : Runtime.consoleAPICalled
params : {
......@@ -82,7 +82,7 @@ From session 2
type : log
}
}
From session 1
From session 2
{
method : Runtime.consoleAPICalled
params : {
......@@ -110,7 +110,7 @@ From session 1
}
}
Error in setTimeout 1
From session 2
From session 1
{
method : Runtime.consoleAPICalled
params : {
......@@ -136,7 +136,7 @@ From session 2
type : error
}
}
From session 1
From session 2
{
method : Runtime.consoleAPICalled
params : {
......@@ -163,7 +163,7 @@ From session 1
}
}
Logging in setTimeout 2
From session 2
From session 1
{
method : Runtime.consoleAPICalled
params : {
......@@ -189,7 +189,7 @@ From session 2
type : log
}
}
From session 1
From session 2
{
method : Runtime.consoleAPICalled
params : {
......
......@@ -2,7 +2,7 @@ Tests that all sessions get exception notifications.
Throwing in 2
Throwing in 1
Throwing in setTimeout 1
From session 2
From session 1
{
method : Runtime.exceptionThrown
params : {
......@@ -31,7 +31,7 @@ From session 2
timestamp : <timestamp>
}
}
From session 1
From session 2
{
method : Runtime.exceptionThrown
params : {
......@@ -61,7 +61,7 @@ From session 1
}
}
Throwing in setTimeout 2
From session 2
From session 1
{
method : Runtime.exceptionThrown
params : {
......@@ -90,7 +90,7 @@ From session 2
timestamp : <timestamp>
}
}
From session 1
From session 2
{
method : Runtime.exceptionThrown
params : {
......@@ -120,7 +120,7 @@ From session 1
}
}
Rejecting in 2
From session 2
From session 1
{
method : Runtime.exceptionThrown
params : {
......@@ -149,7 +149,7 @@ From session 2
timestamp : <timestamp>
}
}
From session 1
From session 2
{
method : Runtime.exceptionThrown
params : {
......@@ -179,7 +179,7 @@ From session 1
}
}
Revoking in 2
From session 2
From session 1
{
method : Runtime.exceptionRevoked
params : {
......@@ -188,7 +188,7 @@ From session 2
}
}
id matching: true
From session 1
From session 2
{
method : Runtime.exceptionRevoked
params : {
......@@ -198,7 +198,7 @@ From session 1
}
id matching: true
Rejecting in 1
From session 2
From session 1
{
method : Runtime.exceptionThrown
params : {
......@@ -227,7 +227,7 @@ From session 2
timestamp : <timestamp>
}
}
From session 1
From session 2
{
method : Runtime.exceptionThrown
params : {
......@@ -257,7 +257,7 @@ From session 1
}
}
Revoking in 1
From session 2
From session 1
{
method : Runtime.exceptionRevoked
params : {
......@@ -266,7 +266,7 @@ From session 2
}
}
id matching: true
From session 1
From session 2
{
method : Runtime.exceptionRevoked
params : {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment