[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/609489
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#47281}
This commit is contained in:
Alexey Kozyatinskiy 2017-08-10 00:18:58 -07:00 committed by Commit Bot
parent 1ca0eea23c
commit cf4adddbfa
8 changed files with 134 additions and 132 deletions

View File

@ -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>>;

View File

@ -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)',

View File

@ -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 => {

View File

@ -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 : {

View File

@ -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:
reason: other
hit breakpoints: test.js:11:0
location: foo@11
data: null
Paused in 1:
reason: other
hit breakpoints: test.js:11:0
location: foo@11
data: null
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:
reason: other
hit breakpoints:
location: bar@25
data: null
Paused in 1:
reason: other
hit breakpoints:
location: bar@25
data: null
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:
reason: other
hit breakpoints:
location: baz@14
data: null
Paused in 1:
reason: other
hit breakpoints: test.js:14:0
location: baz@14
data: null
Paused in 2:
reason: other
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:
reason: other
hit breakpoints: test.js:11:0
location: foo@11
data: null
Paused in 1:
reason: other
hit breakpoints: test.js:11:0
location: foo@11
data: null
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:
reason: other
hit breakpoints:
location: bar@25
data: null
Paused in 1:
reason: other
hit breakpoints:
location: bar@25
data: null
Resuming in 2
Resumed in 2
Resumed in 1
Evaluating exclusive breakpoint in 2
Paused in 2:
reason: other
hit breakpoints:
location: baz@14
location: bar@25
data: null
Resuming in 2
Resumed in 1
Resumed in 2
Evaluating exclusive breakpoint in 2
Paused in 1:
reason: other
hit breakpoints: test.js:14:0
location: baz@14
data: null
Resuming in 1
Resumed in 2
Resumed in 1
Evaluating stepping in 1
Paused in 2:
reason: other
hit breakpoints:
location: baz@14
data: null
Resuming in 1
Resumed in 1
Resumed in 2
Evaluating stepping in 1
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:
reason: other
hit breakpoints:
location: <anonymous>@0
data: null
Resumed in 2
Paused in 1:
reason: other
hit breakpoints:
location: <anonymous>@0
data: null
Resuming in 1
Resumed in 2
Resumed in 1
Pausing in next statement
Paused in 2:
reason: some-reason
reason: other
hit breakpoints:
location: <anonymous>@0
data: {"a":42}
data: null
Resuming in 1
Resumed in 1
Resumed in 2
Pausing in next statement
Paused in 1:
reason: some-reason
hit breakpoints:
location: <anonymous>@0
data: {"a":42}
Resuming in 1
Resumed in 2
Resumed in 1
Pausing in next statement
Paused in 2:
reason: some-reason
hit breakpoints:
location: <anonymous>@0
data: {"a":42}
Resuming in 1
Resumed in 1
Resumed in 2
Pausing in next statement
Paused in 1:
reason: some-reason
hit breakpoints:
location: <anonymous>@0
data: {"a":42}
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:

View File

@ -1,18 +1,18 @@
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
Paused in 2 with reason assert
Asserting in 2
Paused in 2 with reason assert
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
Paused in 2 with reason assert
Asserting in 2
Paused in 2 with reason assert
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

View File

@ -1,6 +1,6 @@
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,32 +163,6 @@ From session 1
}
}
Logging in setTimeout 2
From session 2
{
method : Runtime.consoleAPICalled
params : {
args : [
[0] : {
type : string
value : b
}
]
executionContextId : <executionContextId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 25
functionName : setTimeout
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
timestamp : <timestamp>
type : log
}
}
From session 1
{
method : Runtime.consoleAPICalled
@ -215,3 +189,29 @@ From session 1
type : log
}
}
From session 2
{
method : Runtime.consoleAPICalled
params : {
args : [
[0] : {
type : string
value : b
}
]
executionContextId : <executionContextId>
stackTrace : {
callFrames : [
[0] : {
columnNumber : 25
functionName : setTimeout
lineNumber : 0
scriptId : <scriptId>
url :
}
]
}
timestamp : <timestamp>
type : log
}
}

View File

@ -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,15 +179,6 @@ From session 1
}
}
Revoking in 2
From session 2
{
method : Runtime.exceptionRevoked
params : {
exceptionId : <exceptionId>
reason : Handler added to rejected promise
}
}
id matching: true
From session 1
{
method : Runtime.exceptionRevoked
@ -197,8 +188,17 @@ From session 1
}
}
id matching: true
Rejecting in 1
From session 2
{
method : Runtime.exceptionRevoked
params : {
exceptionId : <exceptionId>
reason : Handler added to rejected promise
}
}
id matching: true
Rejecting in 1
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,15 +257,6 @@ From session 1
}
}
Revoking in 1
From session 2
{
method : Runtime.exceptionRevoked
params : {
exceptionId : <exceptionId>
reason : Handler added to rejected promise
}
}
id matching: true
From session 1
{
method : Runtime.exceptionRevoked
@ -275,3 +266,12 @@ From session 1
}
}
id matching: true
From session 2
{
method : Runtime.exceptionRevoked
params : {
exceptionId : <exceptionId>
reason : Handler added to rejected promise
}
}
id matching: true