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 @@ ...@@ -32,6 +32,7 @@
#define V8_INSPECTOR_V8INSPECTORIMPL_H_ #define V8_INSPECTOR_V8INSPECTORIMPL_H_
#include <functional> #include <functional>
#include <map>
#include "src/base/macros.h" #include "src/base/macros.h"
#include "src/inspector/protocol/Protocol.h" #include "src/inspector/protocol/Protocol.h"
...@@ -134,8 +135,7 @@ class V8InspectorImpl : public V8Inspector { ...@@ -134,8 +135,7 @@ class V8InspectorImpl : public V8Inspector {
ContextsByGroupMap m_contexts; ContextsByGroupMap m_contexts;
// contextGroupId -> sessionId -> session // contextGroupId -> sessionId -> session
protocol::HashMap<int, protocol::HashMap<int, V8InspectorSessionImpl*>> protocol::HashMap<int, std::map<int, V8InspectorSessionImpl*>> m_sessions;
m_sessions;
using ConsoleStorageMap = using ConsoleStorageMap =
protocol::HashMap<int, std::unique_ptr<V8ConsoleMessageStorage>>; protocol::HashMap<int, std::unique_ptr<V8ConsoleMessageStorage>>;
......
...@@ -7,11 +7,13 @@ ...@@ -7,11 +7,13 @@
'./console/', './console/',
'./cpu-profiler/', './cpu-profiler/',
'./debugger/', './debugger/',
'./heap-profiler/',
'./inspector.status', './inspector.status',
'./json-parse-expected.txt', './json-parse-expected.txt',
'./json-parse.js', './json-parse.js',
'./protocol-test.js', './protocol-test.js',
'./runtime/', './runtime/',
'./sessions/',
'./testcfg.py', './testcfg.py',
'../../src/inspector/injected-script-source.js', '../../src/inspector/injected-script-source.js',
'<(PRODUCT_DIR)/inspector-test<(EXECUTABLE_SUFFIX)', '<(PRODUCT_DIR)/inspector-test<(EXECUTABLE_SUFFIX)',
......
...@@ -154,7 +154,7 @@ InspectorTest.ContextGroup = class { ...@@ -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: 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: 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.'); 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(); session.setupScriptMap();
sesison.Protocol.Debugger.enable(); sesison.Protocol.Debugger.enable();
session.Protocol.Debugger.onPaused(message => { session.Protocol.Debugger.onPaused(message => {
......
...@@ -60,7 +60,7 @@ From session 3 ...@@ -60,7 +60,7 @@ From session 3
} }
} }
Destroying and creating context Destroying and creating context
From session 3 From session 2
{ {
method : Runtime.executionContextDestroyed method : Runtime.executionContextDestroyed
params : { params : {
...@@ -76,7 +76,7 @@ From session 1 ...@@ -76,7 +76,7 @@ From session 1
} }
} }
id matching: true id matching: true
From session 2 From session 3
{ {
method : Runtime.executionContextDestroyed method : Runtime.executionContextDestroyed
params : { params : {
...@@ -84,7 +84,7 @@ From session 2 ...@@ -84,7 +84,7 @@ From session 2
} }
} }
id matching: true id matching: true
From session 3 From session 2
{ {
method : Runtime.executionContextCreated method : Runtime.executionContextCreated
params : { params : {
...@@ -106,7 +106,7 @@ From session 1 ...@@ -106,7 +106,7 @@ From session 1
} }
} }
} }
From session 2 From session 3
{ {
method : Runtime.executionContextCreated method : Runtime.executionContextCreated
params : { params : {
......
...@@ -2,170 +2,170 @@ Tests how multiple sessions interact while pausing, stepping, setting breakpoint ...@@ -2,170 +2,170 @@ Tests how multiple sessions interact while pausing, stepping, setting breakpoint
Setting breakpoints in 1 Setting breakpoints in 1
Setting breakpoints in 2 Setting breakpoints in 2
Evaluating common breakpoint in 1 Evaluating common breakpoint in 1
Paused in 2: Paused in 1:
reason: other reason: other
hit breakpoints: test.js:11:0 hit breakpoints: test.js:11:0
location: foo@11 location: foo@11
data: null data: null
Paused in 1: Paused in 2:
reason: other reason: other
hit breakpoints: test.js:11:0 hit breakpoints: test.js:11:0
location: foo@11 location: foo@11
data: null data: null
Resuming in 1 Resuming in 1
Resumed in 2
Resumed in 1 Resumed in 1
Resumed in 2
Evaluating debugger in 1 Evaluating debugger in 1
Paused in 2: Paused in 1:
reason: other reason: other
hit breakpoints: hit breakpoints:
location: bar@25 location: bar@25
data: null data: null
Paused in 1: Paused in 2:
reason: other reason: other
hit breakpoints: hit breakpoints:
location: bar@25 location: bar@25
data: null data: null
Resuming in 2 Resuming in 2
Resumed in 2
Resumed in 1 Resumed in 1
Resumed in 2
Evaluating exclusive breakpoint in 1 Evaluating exclusive breakpoint in 1
Paused in 2: Paused in 1:
reason: other reason: other
hit breakpoints: hit breakpoints: test.js:14:0
location: baz@14 location: baz@14
data: null data: null
Paused in 1: Paused in 2:
reason: other reason: other
hit breakpoints: test.js:14:0 hit breakpoints:
location: baz@14 location: baz@14
data: null data: null
Resuming in 1 Resuming in 1
Resumed in 2
Resumed in 1 Resumed in 1
Resumed in 2
Evaluating common breakpoint in 2 Evaluating common breakpoint in 2
Paused in 2: Paused in 1:
reason: other reason: other
hit breakpoints: test.js:11:0 hit breakpoints: test.js:11:0
location: foo@11 location: foo@11
data: null data: null
Paused in 1: Paused in 2:
reason: other reason: other
hit breakpoints: test.js:11:0 hit breakpoints: test.js:11:0
location: foo@11 location: foo@11
data: null data: null
Resuming in 2 Resuming in 2
Resumed in 2
Resumed in 1 Resumed in 1
Resumed in 2
Evaluating debugger in 2 Evaluating debugger in 2
Paused in 2: Paused in 1:
reason: other reason: other
hit breakpoints: hit breakpoints:
location: bar@25 location: bar@25
data: null data: null
Paused in 1: Paused in 2:
reason: other reason: other
hit breakpoints: hit breakpoints:
location: bar@25 location: bar@25
data: null data: null
Resuming in 2 Resuming in 2
Resumed in 2
Resumed in 1 Resumed in 1
Resumed in 2
Evaluating exclusive breakpoint in 2 Evaluating exclusive breakpoint in 2
Paused in 2: Paused in 1:
reason: other reason: other
hit breakpoints: hit breakpoints: test.js:14:0
location: baz@14 location: baz@14
data: null data: null
Paused in 1: Paused in 2:
reason: other reason: other
hit breakpoints: test.js:14:0 hit breakpoints:
location: baz@14 location: baz@14
data: null data: null
Resuming in 1 Resuming in 1
Resumed in 2
Resumed in 1 Resumed in 1
Resumed in 2
Evaluating stepping in 1 Evaluating stepping in 1
Paused in 2: Paused in 1:
reason: other reason: other
hit breakpoints: hit breakpoints:
location: stepping@17 location: stepping@17
data: null data: null
Paused in 1: Paused in 2:
reason: other reason: other
hit breakpoints: hit breakpoints:
location: stepping@17 location: stepping@17
data: null data: null
Stepping into in 2 Stepping into in 2
Resumed in 2
Resumed in 1 Resumed in 1
Paused in 2: Resumed in 2
Paused in 1:
reason: other reason: other
hit breakpoints: hit breakpoints:
location: stepping@18 location: stepping@18
data: null data: null
Paused in 1: Paused in 2:
reason: other reason: other
hit breakpoints: hit breakpoints:
location: stepping@18 location: stepping@18
data: null data: null
Stepping over in 1 Stepping over in 1
Resumed in 2
Resumed in 1 Resumed in 1
Paused in 2: Resumed in 2
Paused in 1:
reason: other reason: other
hit breakpoints: hit breakpoints:
location: stepping@19 location: stepping@19
data: null data: null
Paused in 1: Paused in 2:
reason: other reason: other
hit breakpoints: hit breakpoints:
location: stepping@19 location: stepping@19
data: null data: null
Stepping out in 2 Stepping out in 2
Resumed in 2
Resumed in 1 Resumed in 1
Paused in 2: Resumed in 2
Paused in 1:
reason: other reason: other
hit breakpoints: hit breakpoints:
location: <anonymous>@0 location: <anonymous>@0
data: null data: null
Paused in 1: Paused in 2:
reason: other reason: other
hit breakpoints: hit breakpoints:
location: <anonymous>@0 location: <anonymous>@0
data: null data: null
Resuming in 1 Resuming in 1
Resumed in 2
Resumed in 1 Resumed in 1
Resumed in 2
Pausing in next statement Pausing in next statement
Paused in 2: Paused in 1:
reason: some-reason reason: some-reason
hit breakpoints: hit breakpoints:
location: <anonymous>@0 location: <anonymous>@0
data: {"a":42} data: {"a":42}
Paused in 1: Paused in 2:
reason: some-reason reason: some-reason
hit breakpoints: hit breakpoints:
location: <anonymous>@0 location: <anonymous>@0
data: {"a":42} data: {"a":42}
Resuming in 1 Resuming in 1
Resumed in 2
Resumed in 1 Resumed in 1
Resumed in 2
Pausing in next statement Pausing in next statement
Paused in 2: Paused in 1:
reason: some-reason reason: some-reason
hit breakpoints: hit breakpoints:
location: <anonymous>@0 location: <anonymous>@0
data: {"a":42} data: {"a":42}
Paused in 1: Paused in 2:
reason: some-reason reason: some-reason
hit breakpoints: hit breakpoints:
location: <anonymous>@0 location: <anonymous>@0
data: {"a":42} data: {"a":42}
Resuming in 2 Resuming in 2
Resumed in 2
Resumed in 1 Resumed in 1
Resumed in 2
Blackboxing bar() in 2 Blackboxing bar() in 2
Evaluating bar() in 2 Evaluating bar() in 2
Paused in 1: Paused in 1:
......
Tests that multiple sessions pause once on console.assert. Tests that multiple sessions pause once on console.assert.
Pausing on exceptions in 1 Pausing on exceptions in 1
Asserting in 1 Asserting in 1
Paused in 2 with reason assert
Paused in 1 with reason assert Paused in 1 with reason assert
Asserting in 2
Paused in 2 with reason assert Paused in 2 with reason assert
Asserting in 2
Paused in 1 with reason assert Paused in 1 with reason assert
Paused in 2 with reason assert
Pausing on exceptions in both Pausing on exceptions in both
Asserting in 1 Asserting in 1
Paused in 2 with reason assert
Paused in 1 with reason assert Paused in 1 with reason assert
Asserting in 2
Paused in 2 with reason assert Paused in 2 with reason assert
Asserting in 2
Paused in 1 with reason assert Paused in 1 with reason assert
Paused in 2 with reason assert
Not pausing on exceptions Not pausing on exceptions
Asserting in 1 Asserting in 1
Asserting in 2 Asserting in 2
...@@ -20,5 +20,5 @@ Pausing on exceptions in 3 (different context group) ...@@ -20,5 +20,5 @@ Pausing on exceptions in 3 (different context group)
Asserting in 3 Asserting in 3
Paused in 3 with reason assert Paused in 3 with reason assert
Asserting in 1 Asserting in 1
Paused in 2 with reason assert
Paused in 1 with reason assert Paused in 1 with reason assert
Paused in 2 with reason assert
Tests that all sessions get console api notifications. Tests that all sessions get console api notifications.
Error in 2 Error in 2
From session 2 From session 1
{ {
method : Runtime.consoleAPICalled method : Runtime.consoleAPICalled
params : { params : {
...@@ -27,7 +27,7 @@ From session 2 ...@@ -27,7 +27,7 @@ From session 2
type : error type : error
} }
} }
From session 1 From session 2
{ {
method : Runtime.consoleAPICalled method : Runtime.consoleAPICalled
params : { params : {
...@@ -55,7 +55,7 @@ From session 1 ...@@ -55,7 +55,7 @@ From session 1
} }
} }
Logging in 1 Logging in 1
From session 2 From session 1
{ {
method : Runtime.consoleAPICalled method : Runtime.consoleAPICalled
params : { params : {
...@@ -82,7 +82,7 @@ From session 2 ...@@ -82,7 +82,7 @@ From session 2
type : log type : log
} }
} }
From session 1 From session 2
{ {
method : Runtime.consoleAPICalled method : Runtime.consoleAPICalled
params : { params : {
...@@ -110,7 +110,7 @@ From session 1 ...@@ -110,7 +110,7 @@ From session 1
} }
} }
Error in setTimeout 1 Error in setTimeout 1
From session 2 From session 1
{ {
method : Runtime.consoleAPICalled method : Runtime.consoleAPICalled
params : { params : {
...@@ -136,7 +136,7 @@ From session 2 ...@@ -136,7 +136,7 @@ From session 2
type : error type : error
} }
} }
From session 1 From session 2
{ {
method : Runtime.consoleAPICalled method : Runtime.consoleAPICalled
params : { params : {
...@@ -163,7 +163,7 @@ From session 1 ...@@ -163,7 +163,7 @@ From session 1
} }
} }
Logging in setTimeout 2 Logging in setTimeout 2
From session 2 From session 1
{ {
method : Runtime.consoleAPICalled method : Runtime.consoleAPICalled
params : { params : {
...@@ -189,7 +189,7 @@ From session 2 ...@@ -189,7 +189,7 @@ From session 2
type : log type : log
} }
} }
From session 1 From session 2
{ {
method : Runtime.consoleAPICalled method : Runtime.consoleAPICalled
params : { params : {
......
...@@ -2,7 +2,7 @@ Tests that all sessions get exception notifications. ...@@ -2,7 +2,7 @@ Tests that all sessions get exception notifications.
Throwing in 2 Throwing in 2
Throwing in 1 Throwing in 1
Throwing in setTimeout 1 Throwing in setTimeout 1
From session 2 From session 1
{ {
method : Runtime.exceptionThrown method : Runtime.exceptionThrown
params : { params : {
...@@ -31,7 +31,7 @@ From session 2 ...@@ -31,7 +31,7 @@ From session 2
timestamp : <timestamp> timestamp : <timestamp>
} }
} }
From session 1 From session 2
{ {
method : Runtime.exceptionThrown method : Runtime.exceptionThrown
params : { params : {
...@@ -61,7 +61,7 @@ From session 1 ...@@ -61,7 +61,7 @@ From session 1
} }
} }
Throwing in setTimeout 2 Throwing in setTimeout 2
From session 2 From session 1
{ {
method : Runtime.exceptionThrown method : Runtime.exceptionThrown
params : { params : {
...@@ -90,7 +90,7 @@ From session 2 ...@@ -90,7 +90,7 @@ From session 2
timestamp : <timestamp> timestamp : <timestamp>
} }
} }
From session 1 From session 2
{ {
method : Runtime.exceptionThrown method : Runtime.exceptionThrown
params : { params : {
...@@ -120,7 +120,7 @@ From session 1 ...@@ -120,7 +120,7 @@ From session 1
} }
} }
Rejecting in 2 Rejecting in 2
From session 2 From session 1
{ {
method : Runtime.exceptionThrown method : Runtime.exceptionThrown
params : { params : {
...@@ -149,7 +149,7 @@ From session 2 ...@@ -149,7 +149,7 @@ From session 2
timestamp : <timestamp> timestamp : <timestamp>
} }
} }
From session 1 From session 2
{ {
method : Runtime.exceptionThrown method : Runtime.exceptionThrown
params : { params : {
...@@ -179,7 +179,7 @@ From session 1 ...@@ -179,7 +179,7 @@ From session 1
} }
} }
Revoking in 2 Revoking in 2
From session 2 From session 1
{ {
method : Runtime.exceptionRevoked method : Runtime.exceptionRevoked
params : { params : {
...@@ -188,7 +188,7 @@ From session 2 ...@@ -188,7 +188,7 @@ From session 2
} }
} }
id matching: true id matching: true
From session 1 From session 2
{ {
method : Runtime.exceptionRevoked method : Runtime.exceptionRevoked
params : { params : {
...@@ -198,7 +198,7 @@ From session 1 ...@@ -198,7 +198,7 @@ From session 1
} }
id matching: true id matching: true
Rejecting in 1 Rejecting in 1
From session 2 From session 1
{ {
method : Runtime.exceptionThrown method : Runtime.exceptionThrown
params : { params : {
...@@ -227,7 +227,7 @@ From session 2 ...@@ -227,7 +227,7 @@ From session 2
timestamp : <timestamp> timestamp : <timestamp>
} }
} }
From session 1 From session 2
{ {
method : Runtime.exceptionThrown method : Runtime.exceptionThrown
params : { params : {
...@@ -257,7 +257,7 @@ From session 1 ...@@ -257,7 +257,7 @@ From session 1
} }
} }
Revoking in 1 Revoking in 1
From session 2 From session 1
{ {
method : Runtime.exceptionRevoked method : Runtime.exceptionRevoked
params : { params : {
...@@ -266,7 +266,7 @@ From session 2 ...@@ -266,7 +266,7 @@ From session 2
} }
} }
id matching: true id matching: true
From session 1 From session 2
{ {
method : Runtime.exceptionRevoked method : Runtime.exceptionRevoked
params : { 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