Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: content/browser/devtools/protocol/devtools_protocol_browsertest.cc

Issue 1358153002: Issue AboutToNavigateRenderFrame notification after beforeunload handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: test fixes Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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", &notification));
@@ -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 {
« no previous file with comments | « no previous file | content/browser/frame_host/navigator_impl.cc » ('j') | content/browser/frame_host/navigator_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698