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/headless_browser.h" | 8 #include "headless/public/headless_browser.h" |
9 #include "headless/public/headless_web_contents.h" | 9 #include "headless/public/headless_web_contents.h" |
10 #include "headless/test/headless_browser_test.h" | 10 #include "headless/test/headless_browser_test.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // from headless/test/data as expected. We should fix this. | 71 // from headless/test/data as expected. We should fix this. |
72 HeadlessWebContents* web_contents = browser()->CreateWebContents( | 72 HeadlessWebContents* web_contents = browser()->CreateWebContents( |
73 GURL("http://not-an-actual-domain.tld/hello.html"), gfx::Size(800, 600)); | 73 GURL("http://not-an-actual-domain.tld/hello.html"), gfx::Size(800, 600)); |
74 EXPECT_TRUE(WaitForLoad(web_contents)); | 74 EXPECT_TRUE(WaitForLoad(web_contents)); |
75 EXPECT_EQ(static_cast<size_t>(1), browser()->GetAllWebContents().size()); | 75 EXPECT_EQ(static_cast<size_t>(1), browser()->GetAllWebContents().size()); |
76 EXPECT_EQ(web_contents, browser()->GetAllWebContents()[0]); | 76 EXPECT_EQ(web_contents, browser()->GetAllWebContents()[0]); |
77 web_contents->Close(); | 77 web_contents->Close(); |
78 EXPECT_TRUE(browser()->GetAllWebContents().empty()); | 78 EXPECT_TRUE(browser()->GetAllWebContents().empty()); |
79 } | 79 } |
80 | 80 |
| 81 IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, SetHostResolverRules) { |
| 82 EXPECT_TRUE(embedded_test_server()->Start()); |
| 83 HeadlessBrowser::Options::Builder builder; |
| 84 builder.SetHostResolverRules("MAP not-an-actual-domain.tld 127.0.0.1"); |
| 85 SetBrowserOptions(builder.Build()); |
| 86 |
| 87 // Load a page which doesn't actually exist, but which is turned into a valid |
| 88 // address by our host resolver rules. |
| 89 HeadlessWebContents* web_contents = browser()->CreateWebContents( |
| 90 GURL("http://not-an-actual-domain.tld/hello.html"), gfx::Size(800, 600)); |
| 91 EXPECT_TRUE(WaitForLoad(web_contents)); |
| 92 } |
| 93 |
81 } // namespace headless | 94 } // namespace headless |
OLD | NEW |