Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(695)

Side by Side Diff: headless/lib/headless_browser_browsertest.cc

Issue 1912673002: headless: Add support for host resolver mapping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased again Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
OLDNEW
« no previous file with comments | « headless/lib/browser/headless_url_request_context_getter.cc ('k') | headless/public/headless_browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698