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

Side by Side 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 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/devtools/protocol/page_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stddef.h> 5 #include <stddef.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 995 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 } 1006 }
1007 num_to_wait_for_ = 0; 1007 num_to_wait_for_ = 0;
1008 } 1008 }
1009 1009
1010 private: 1010 private:
1011 int num_finished_; 1011 int num_finished_;
1012 int num_to_wait_for_; 1012 int num_to_wait_for_;
1013 }; 1013 };
1014 } // namespace 1014 } // namespace
1015 1015
1016 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, PageStopLoading) {
1017 ASSERT_TRUE(embedded_test_server()->Start());
1018
1019 // Navigate to about:blank first so we can make sure there is a target page we
1020 // can attach to, and have Page.setControlNavigations complete before we start
1021 // the navigations we're interested in.
1022 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1);
1023 Attach();
1024
1025 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue());
1026 params->SetBoolean("enabled", true);
1027 SendCommand("Page.setControlNavigations", std::move(params), true);
1028
1029 NavigationFinishedObserver navigation_finished_observer(
1030 shell()->web_contents());
1031
1032 // The page will try to navigate twice, however since
1033 // Page.setControlNavigations is true, it'll wait for confirmation before
1034 // committing to the navigation.
1035 GURL test_url = embedded_test_server()->GetURL(
1036 "/devtools/control_navigations/meta_tag.html");
1037 shell()->LoadURL(test_url);
1038
1039 // Stop all navigations.
1040 SendCommand("Page.stopLoading", nullptr);
1041
1042 // Wait for the initial navigation to finish.
1043 navigation_finished_observer.WaitForNavigationsToFinish(1);
1044 }
1045
1016 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, ControlNavigationsMainFrame) { 1046 IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, ControlNavigationsMainFrame) {
1017 ASSERT_TRUE(embedded_test_server()->Start()); 1047 ASSERT_TRUE(embedded_test_server()->Start());
1018 1048
1019 // Navigate to about:blank first so we can make sure there is a target page we 1049 // Navigate to about:blank first so we can make sure there is a target page we
1020 // can attach to, and have Page.setControlNavigations complete before we start 1050 // can attach to, and have Page.setControlNavigations complete before we start
1021 // the navigations we're interested in. 1051 // the navigations we're interested in.
1022 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1); 1052 NavigateToURLBlockUntilNavigationsComplete(shell(), GURL("about:blank"), 1);
1023 Attach(); 1053 Attach();
1024 1054
1025 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue()); 1055 std::unique_ptr<base::DictionaryValue> params(new base::DictionaryValue());
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1395 command_params.reset(new base::DictionaryValue()); 1425 command_params.reset(new base::DictionaryValue());
1396 command_params->SetBoolean("autoAttach", false); 1426 command_params->SetBoolean("autoAttach", false);
1397 command_params->SetBoolean("waitForDebuggerOnStart", false); 1427 command_params->SetBoolean("waitForDebuggerOnStart", false);
1398 SendCommand("Target.setAutoAttach", std::move(command_params), false); 1428 SendCommand("Target.setAutoAttach", std::move(command_params), false);
1399 params = WaitForNotification("Target.detachedFromTarget", true); 1429 params = WaitForNotification("Target.detachedFromTarget", true);
1400 EXPECT_TRUE(params->GetString("targetId", &temp)); 1430 EXPECT_TRUE(params->GetString("targetId", &temp));
1401 EXPECT_EQ(target_id, temp); 1431 EXPECT_EQ(target_id, temp);
1402 } 1432 }
1403 1433
1404 } // namespace content 1434 } // namespace content
OLDNEW
« 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