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

Unified Diff: content/renderer/render_view_browsertest.cc

Issue 1867423002: [DevTools] Handle iframes when forcing contexts on runtime.enable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/inspector/PageRuntimeAgent.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_view_browsertest.cc
diff --git a/content/renderer/render_view_browsertest.cc b/content/renderer/render_view_browsertest.cc
index de245797b3bf818fe24cc380a902ba433e6ec435..6a3c7408760246a8c90aeb51d8601f8f4fe83458 100644
--- a/content/renderer/render_view_browsertest.cc
+++ b/content/renderer/render_view_browsertest.cc
@@ -416,12 +416,13 @@ class DevToolsAgentTest : public RenderViewImplTest {
}
}
- bool HasNotifications(const std::string& notification, int count) {
+ int CountNotifications(const std::string& notification) {
+ int result = 0;
for (const std::string& s : notifications_) {
if (s == notification)
- --count;
+ ++result;
}
- return count <= 0;
+ return result;
}
private:
@@ -2383,19 +2384,19 @@ TEST_F(DevToolsAgentTest, DevToolsResumeOnClose) {
Detach();
}
-TEST_F(DevToolsAgentTest, RuntimeEnableForcesMainContext) {
- LoadHTML("");
+TEST_F(DevToolsAgentTest, RuntimeEnableForcesContexts) {
+ LoadHTML("<body>page<iframe></iframe></body>");
Attach();
DispatchDevToolsMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
- EXPECT_TRUE(HasNotifications("Runtime.executionContextCreated", 1));
+ EXPECT_EQ(2, CountNotifications("Runtime.executionContextCreated"));
}
TEST_F(DevToolsAgentTest, RuntimeEnableForcesContextsAfterNavigation) {
Attach();
DispatchDevToolsMessage("{\"id\":1,\"method\":\"Runtime.enable\"}");
- EXPECT_FALSE(HasNotifications("Runtime.executionContextCreated", 1));
+ EXPECT_EQ(0, CountNotifications("Runtime.executionContextCreated"));
LoadHTML("<body>page<iframe></iframe></body>");
- EXPECT_TRUE(HasNotifications("Runtime.executionContextCreated", 2));
+ EXPECT_EQ(2, CountNotifications("Runtime.executionContextCreated"));
}
} // namespace content
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/inspector/PageRuntimeAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698