| 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> |
| 6 |
| 5 #include "content/public/test/browser_test.h" | 7 #include "content/public/test/browser_test.h" |
| 6 #include "headless/public/headless_browser.h" | 8 #include "headless/public/headless_browser.h" |
| 7 #include "headless/public/headless_web_contents.h" | 9 #include "headless/public/headless_web_contents.h" |
| 8 #include "headless/test/headless_browser_test.h" | 10 #include "headless/test/headless_browser_test.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
| 11 #include "url/gurl.h" | 13 #include "url/gurl.h" |
| 12 | 14 |
| 13 namespace headless { | 15 namespace headless { |
| 14 | 16 |
| 15 class HeadlessWebContentsTest : public HeadlessBrowserTest {}; | 17 class HeadlessWebContentsTest : public HeadlessBrowserTest {}; |
| 16 | 18 |
| 17 IN_PROC_BROWSER_TEST_F(HeadlessWebContentsTest, Navigation) { | 19 IN_PROC_BROWSER_TEST_F(HeadlessWebContentsTest, Navigation) { |
| 18 EXPECT_TRUE(embedded_test_server()->Start()); | 20 EXPECT_TRUE(embedded_test_server()->Start()); |
| 19 scoped_ptr<HeadlessWebContents> web_contents = | 21 std::unique_ptr<HeadlessWebContents> web_contents = |
| 20 browser()->CreateWebContents(gfx::Size(800, 600)); | 22 browser()->CreateWebContents(gfx::Size(800, 600)); |
| 21 EXPECT_TRUE(NavigateAndWaitForLoad( | 23 EXPECT_TRUE(NavigateAndWaitForLoad( |
| 22 web_contents.get(), embedded_test_server()->GetURL("/hello.html"))); | 24 web_contents.get(), embedded_test_server()->GetURL("/hello.html"))); |
| 23 } | 25 } |
| 24 | 26 |
| 25 IN_PROC_BROWSER_TEST_F(HeadlessWebContentsTest, NavigationWithBadURL) { | 27 IN_PROC_BROWSER_TEST_F(HeadlessWebContentsTest, NavigationWithBadURL) { |
| 26 scoped_ptr<HeadlessWebContents> web_contents = | 28 std::unique_ptr<HeadlessWebContents> web_contents = |
| 27 browser()->CreateWebContents(gfx::Size(800, 600)); | 29 browser()->CreateWebContents(gfx::Size(800, 600)); |
| 28 GURL bad_url("not_valid"); | 30 GURL bad_url("not_valid"); |
| 29 EXPECT_FALSE(web_contents->OpenURL(bad_url)); | 31 EXPECT_FALSE(web_contents->OpenURL(bad_url)); |
| 30 } | 32 } |
| 31 | 33 |
| 32 } // namespace headless | 34 } // namespace headless |
| OLD | NEW |