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

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: 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 60
61 // Load a page which doesn't actually exist, but for which the our proxy 61 // Load a page which doesn't actually exist, but for which the our proxy
62 // returns valid content anyway. 62 // returns valid content anyway.
63 std::unique_ptr<HeadlessWebContents> web_contents = 63 std::unique_ptr<HeadlessWebContents> web_contents =
64 browser()->CreateWebContents( 64 browser()->CreateWebContents(
65 GURL("http://not-an-actual-domain.tld/hello.html"), 65 GURL("http://not-an-actual-domain.tld/hello.html"),
66 gfx::Size(800, 600)); 66 gfx::Size(800, 600));
67 EXPECT_TRUE(WaitForLoad(web_contents.get())); 67 EXPECT_TRUE(WaitForLoad(web_contents.get()));
68 } 68 }
69 69
70 IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, SetProxyServer) {
altimin 2016/04/21 14:35:55 Nit: maybe we can come up with a better name for t
Sami 2016/04/21 14:58:37 Hmm, not a bad idea :D
71 EXPECT_TRUE(embedded_test_server()->Start());
72 HeadlessBrowser::Options::Builder builder;
73 builder.SetHostResolverRules("MAP not-an-actual-domain.tld 127.0.0.1");
74 SetBrowserOptions(builder.Build());
75
76 // Load a page which doesn't actually exist, but which is turned into a valid
77 // address by our host resolver rules.
78 std::unique_ptr<HeadlessWebContents> web_contents =
79 browser()->CreateWebContents(
80 GURL("http://not-an-actual-domain.tld/hello.html"),
81 gfx::Size(800, 600));
82 EXPECT_TRUE(WaitForLoad(web_contents.get()));
83 }
84
70 } // namespace headless 85 } // 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