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

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

Issue 2525903003: Add Page.stopLoading to devtools and --timeout switch to headless_shell (Closed)
Patch Set: FixPage.stopLoading command description. Created 4 years, 1 month 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 | content/browser/devtools/protocol/page_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 025f6bde7541cd133d795fd085a2020b6460472d..da2011d094a6f6f8982d79e94997d430ad5b7f59 100644
--- a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc
+++ b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc
@@ -1013,6 +1013,36 @@ class NavigationFinishedObserver : public content::WebContentsObserver {
};
} // namespace
+IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, PageStopLoading) {
+ ASSERT_TRUE(embedded_test_server()->Start());
+
+ // Navigate to about:blank first so we can make sure there is a target page we
+ // can attach to, and have Page.setControlNavigations complete before we start
+ // the navigations we're interested in.
+ NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1);
+ Attach();
+
+ std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue());
+ params->SetBoolean("enabled", true);
+ SendCommand("Page.setControlNavigations", std::move(params), true);
+
+ NavigationFinishedObserver navigation_finished_observer(
+ shell()->web_contents());
+
+ // The page will try to navigate twice, however since
+ // Page.setControlNavigations is true, it'll wait for confirmation before
+ // committing to the navigation.
+ GURL test_url = embedded_test_server()->GetURL(
+ "/devtools/control_navigations/meta_tag.html");
+ shell()->LoadURL(test_url);
+
+ // Stop all navigations.
+ SendCommand("Page.stopLoading", nullptr);
+
+ // Wait for the initial navigation to finish.
+ navigation_finished_observer.WaitForNavigationsToFinish(1);
+}
+
IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, ControlNavigationsMainFrame) {
ASSERT_TRUE(embedded_test_server()->Start());
« no previous file with comments | « no previous file | content/browser/devtools/protocol/page_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698