| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 } | 426 } |
| 427 | 427 |
| 428 private: | 428 private: |
| 429 std::string context_id_; | 429 std::string context_id_; |
| 430 std::string page_id_; | 430 std::string page_id_; |
| 431 }; | 431 }; |
| 432 | 432 |
| 433 HEADLESS_ASYNC_DEVTOOLED_TEST_F(TargetDomainDisposeContextFailsIfInUse); | 433 HEADLESS_ASYNC_DEVTOOLED_TEST_F(TargetDomainDisposeContextFailsIfInUse); |
| 434 | 434 |
| 435 class TargetDomainCreateTwoContexts : public HeadlessAsyncDevTooledBrowserTest, | 435 class TargetDomainCreateTwoContexts : public HeadlessAsyncDevTooledBrowserTest, |
| 436 public target::ExperimentalObserver { | 436 public target::ExperimentalObserver, |
| 437 public page::Observer { |
| 437 public: | 438 public: |
| 438 void RunDevTooledTest() override { | 439 void RunDevTooledTest() override { |
| 439 EXPECT_TRUE(embedded_test_server()->Start()); | 440 EXPECT_TRUE(embedded_test_server()->Start()); |
| 440 | 441 |
| 442 base::RunLoop run_loop; |
| 443 devtools_client_->GetPage()->AddObserver(this); |
| 444 devtools_client_->GetPage()->Enable(run_loop.QuitClosure()); |
| 445 base::MessageLoop::ScopedNestableTaskAllower nest_loop( |
| 446 base::MessageLoop::current()); |
| 447 run_loop.Run(); |
| 448 |
| 441 devtools_client_->GetTarget()->GetExperimental()->AddObserver(this); | 449 devtools_client_->GetTarget()->GetExperimental()->AddObserver(this); |
| 442 devtools_client_->GetTarget()->GetExperimental()->CreateBrowserContext( | 450 devtools_client_->GetTarget()->GetExperimental()->CreateBrowserContext( |
| 443 target::CreateBrowserContextParams::Builder().Build(), | 451 target::CreateBrowserContextParams::Builder().Build(), |
| 444 base::Bind(&TargetDomainCreateTwoContexts::OnContextOneCreated, | 452 base::Bind(&TargetDomainCreateTwoContexts::OnContextOneCreated, |
| 445 base::Unretained(this))); | 453 base::Unretained(this))); |
| 446 | 454 |
| 447 devtools_client_->GetTarget()->GetExperimental()->CreateBrowserContext( | 455 devtools_client_->GetTarget()->GetExperimental()->CreateBrowserContext( |
| 448 target::CreateBrowserContextParams::Builder().Build(), | 456 target::CreateBrowserContextParams::Builder().Build(), |
| 449 base::Bind(&TargetDomainCreateTwoContexts::OnContextTwoCreated, | 457 base::Bind(&TargetDomainCreateTwoContexts::OnContextTwoCreated, |
| 450 base::Unretained(this))); | 458 base::Unretained(this))); |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 | 879 |
| 872 std::map<std::string, std::string> request_id_to_path_; | 880 std::map<std::string, std::string> request_id_to_path_; |
| 873 std::vector<std::string> requests_to_be_sent_; | 881 std::vector<std::string> requests_to_be_sent_; |
| 874 std::vector<std::string> responses_received_; | 882 std::vector<std::string> responses_received_; |
| 875 std::vector<std::string> failures_; | 883 std::vector<std::string> failures_; |
| 876 }; | 884 }; |
| 877 | 885 |
| 878 HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessDevToolsNetworkBlockedUrlTest); | 886 HEADLESS_ASYNC_DEVTOOLED_TEST_F(HeadlessDevToolsNetworkBlockedUrlTest); |
| 879 | 887 |
| 880 } // namespace headless | 888 } // namespace headless |
| OLD | NEW |