| 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 "content/public/test/browser_test.h" | 7 #include "content/public/test/browser_test.h" |
| 8 #include "headless/public/domains/page.h" | 8 #include "headless/public/domains/page.h" |
| 9 #include "headless/public/domains/runtime.h" | 9 #include "headless/public/domains/runtime.h" |
| 10 #include "headless/public/headless_browser.h" | 10 #include "headless/public/headless_browser.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 protected: | 42 protected: |
| 43 void RunTest() { | 43 void RunTest() { |
| 44 web_contents_ = | 44 web_contents_ = |
| 45 browser()->CreateWebContents(GURL("about:blank"), gfx::Size(800, 600)); | 45 browser()->CreateWebContents(GURL("about:blank"), gfx::Size(800, 600)); |
| 46 web_contents_->AddObserver(this); | 46 web_contents_->AddObserver(this); |
| 47 | 47 |
| 48 RunAsynchronousTest(); | 48 RunAsynchronousTest(); |
| 49 | 49 |
| 50 web_contents_->GetDevToolsTarget()->DetachClient(devtools_client_.get()); | 50 web_contents_->GetDevToolsTarget()->DetachClient(devtools_client_.get()); |
| 51 web_contents_->RemoveObserver(this); | 51 web_contents_->RemoveObserver(this); |
| 52 web_contents_->Close(); |
| 52 web_contents_ = nullptr; | 53 web_contents_ = nullptr; |
| 53 } | 54 } |
| 54 | 55 |
| 55 std::unique_ptr<HeadlessWebContents> web_contents_; | 56 HeadlessWebContents* web_contents_; |
| 56 std::unique_ptr<HeadlessDevToolsClient> devtools_client_; | 57 std::unique_ptr<HeadlessDevToolsClient> devtools_client_; |
| 57 }; | 58 }; |
| 58 | 59 |
| 59 class HeadlessDevToolsClientNavigationTest : public HeadlessDevToolsClientTest { | 60 class HeadlessDevToolsClientNavigationTest : public HeadlessDevToolsClientTest { |
| 60 public: | 61 public: |
| 61 void RunDevToolsClientTest() override { | 62 void RunDevToolsClientTest() override { |
| 62 EXPECT_TRUE(embedded_test_server()->Start()); | 63 EXPECT_TRUE(embedded_test_server()->Start()); |
| 63 std::unique_ptr<page::NavigateParams> params = | 64 std::unique_ptr<page::NavigateParams> params = |
| 64 page::NavigateParams::Builder() | 65 page::NavigateParams::Builder() |
| 65 .SetUrl(embedded_test_server()->GetURL("/hello.html").spec()) | 66 .SetUrl(embedded_test_server()->GetURL("/hello.html").spec()) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 FinishAsynchronousTest(); | 140 FinishAsynchronousTest(); |
| 140 } | 141 } |
| 141 | 142 |
| 142 private: | 143 private: |
| 143 bool first_result_received_; | 144 bool first_result_received_; |
| 144 }; | 145 }; |
| 145 | 146 |
| 146 DEVTOOLS_CLIENT_TEST_F(HeadlessDevToolsClientCallbackTest); | 147 DEVTOOLS_CLIENT_TEST_F(HeadlessDevToolsClientCallbackTest); |
| 147 | 148 |
| 148 } // namespace headless | 149 } // namespace headless |
| OLD | NEW |