Chromium Code Reviews| Index: content/browser/devtools/protocol/devtools_protocol_browsertest.cc |
| diff --git a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc |
| index 12491215fe430534fc02b9cee96d2c6413a462e3..575fa94b2a654909a478995625ae225795d16d11 100644 |
| --- a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc |
| +++ b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc |
| @@ -38,7 +38,8 @@ class DevToolsProtocolTest : public ContentBrowserTest, |
| DevToolsProtocolTest() |
| : last_sent_id_(0), |
| waiting_for_notifications_count_(0), |
| - in_dispatch_(false) { |
| + in_dispatch_(false), |
| + waiting_for_command_result_id_(0) { |
|
Charlie Reis
2015/09/22 23:12:10
What are these test changes? I don't see a test f
dgozman
2015/09/22 23:27:55
This is a side-effect of different timings between
Charlie Reis
2015/09/22 23:56:42
Ok, thanks. It'd probably be worthwhile to includ
|
| } |
| protected: |
| @@ -62,8 +63,10 @@ class DevToolsProtocolTest : public ContentBrowserTest, |
| agent_host_->DispatchProtocolMessage(json_command); |
| // Some messages are dispatched synchronously. |
| // Only run loop if we are not finished yet. |
| - if (in_dispatch_ && wait) |
| + if (in_dispatch_ && wait) { |
| + waiting_for_command_result_id_ = last_sent_id_; |
| base::MessageLoop::current()->Run(); |
| + } |
| in_dispatch_ = false; |
| } |
| @@ -127,8 +130,10 @@ class DevToolsProtocolTest : public ContentBrowserTest, |
| EXPECT_TRUE(root->GetDictionary("result", &result)); |
| result_.reset(result->DeepCopy()); |
| in_dispatch_ = false; |
| - if (base::MessageLoop::current()->is_running()) |
| + if (id && id == waiting_for_command_result_id_) { |
| + waiting_for_command_result_id_ = 0; |
| base::MessageLoop::current()->QuitNow(); |
| + } |
| } else { |
| std::string notification; |
| EXPECT_TRUE(root->GetString("method", ¬ification)); |
| @@ -147,6 +152,7 @@ class DevToolsProtocolTest : public ContentBrowserTest, |
| int waiting_for_notifications_count_; |
| bool in_dispatch_; |
| + int waiting_for_command_result_id_; |
| }; |
| class SyntheticKeyEventTest : public DevToolsProtocolTest { |