| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "content/public/browser/render_widget_host_view.h" | 9 #include "content/public/browser/render_widget_host_view.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| (...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 void RunDevTooledTest() override { | 830 void RunDevTooledTest() override { |
| 831 EXPECT_TRUE(embedded_test_server()->Start()); | 831 EXPECT_TRUE(embedded_test_server()->Start()); |
| 832 base::RunLoop run_loop; | 832 base::RunLoop run_loop; |
| 833 devtools_client_->GetPage()->AddObserver(this); | 833 devtools_client_->GetPage()->AddObserver(this); |
| 834 devtools_client_->GetPage()->Enable(); | 834 devtools_client_->GetPage()->Enable(); |
| 835 devtools_client_->GetNetwork()->AddObserver(this); | 835 devtools_client_->GetNetwork()->AddObserver(this); |
| 836 devtools_client_->GetNetwork()->Enable(run_loop.QuitClosure()); | 836 devtools_client_->GetNetwork()->Enable(run_loop.QuitClosure()); |
| 837 base::MessageLoop::ScopedNestableTaskAllower nest_loop( | 837 base::MessageLoop::ScopedNestableTaskAllower nest_loop( |
| 838 base::MessageLoop::current()); | 838 base::MessageLoop::current()); |
| 839 run_loop.Run(); | 839 run_loop.Run(); |
| 840 devtools_client_->GetNetwork()->GetExperimental()->AddBlockedURL( | 840 std::vector<std::string> blockedUrls; |
| 841 network::AddBlockedURLParams::Builder() | 841 blockedUrls.push_back("dom_tree_test.css"); |
| 842 .SetUrl("dom_tree_test.css") | 842 devtools_client_->GetNetwork()->GetExperimental()->SetBlockedURLs( |
| 843 .Build()); | 843 network::SetBlockedURLsParams::Builder().SetUrls(blockedUrls).Build()); |
| 844 devtools_client_->GetPage()->Navigate( | 844 devtools_client_->GetPage()->Navigate( |
| 845 embedded_test_server()->GetURL("/dom_tree_test.html").spec()); | 845 embedded_test_server()->GetURL("/dom_tree_test.html").spec()); |
| 846 } | 846 } |
| 847 | 847 |
| 848 std::string GetUrlPath(const std::string& url) const { | 848 std::string GetUrlPath(const std::string& url) const { |
| 849 GURL gurl(url); | 849 GURL gurl(url); |
| 850 return gurl.path(); | 850 return gurl.path(); |
| 851 } | 851 } |
| 852 | 852 |
| 853 void OnRequestWillBeSent( | 853 void OnRequestWillBeSent( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 879 | 879 |
| 880 std::map<std::string, std::string> request_id_to_path_; | 880 std::map<std::string, std::string> request_id_to_path_; |
| 881 std::vector<std::string> requests_to_be_sent_; | 881 std::vector<std::string> requests_to_be_sent_; |
| 882 std::vector<std::string> responses_received_; | 882 std::vector<std::string> responses_received_; |
| 883 std::vector<std::string> failures_; | 883 std::vector<std::string> failures_; |
| 884 }; | 884 }; |
| 885 | 885 |
| 886 HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessDevToolsNetworkBlockedUrlTest); | 886 HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessDevToolsNetworkBlockedUrlTest); |
| 887 | 887 |
| 888 } // namespace headless | 888 } // namespace headless |
| OLD | NEW |