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

Unified Diff: headless/lib/headless_browser_browsertest.cc

Issue 1858403003: headless: Require the user to pass in an initial URL (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 side-by-side diff with in-line comments
Download patch
Index: headless/lib/headless_browser_browsertest.cc
diff --git a/headless/lib/headless_browser_browsertest.cc b/headless/lib/headless_browser_browsertest.cc
index be3dffa20027ebd5db57c9de6c02ac3855b0736f..9cc594073cef0d6aa78bdb2c4ff4f8c6b55923ad 100644
--- a/headless/lib/headless_browser_browsertest.cc
+++ b/headless/lib/headless_browser_browsertest.cc
@@ -16,12 +16,19 @@ namespace headless {
IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, CreateAndDestroyWebContents) {
std::unique_ptr<HeadlessWebContents> web_contents =
- browser()->CreateWebContents(gfx::Size(800, 600));
+ browser()->CreateWebContents(GURL("about:blank"), gfx::Size(800, 600));
EXPECT_TRUE(web_contents);
// TODO(skyostil): Verify viewport dimensions once we can.
web_contents.reset();
}
+IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, CreateWithBadURL) {
+ GURL bad_url("not_valid");
+ std::unique_ptr<HeadlessWebContents> web_contents =
+ browser()->CreateWebContents(bad_url, gfx::Size(800, 600));
+ EXPECT_FALSE(web_contents);
+}
+
class HeadlessBrowserTestWithProxy : public HeadlessBrowserTest {
public:
HeadlessBrowserTestWithProxy()
@@ -51,13 +58,13 @@ IN_PROC_BROWSER_TEST_F(HeadlessBrowserTestWithProxy, SetProxyServer) {
builder.SetProxyServer(proxy_server()->host_port_pair());
SetBrowserOptions(builder.Build());
- std::unique_ptr<HeadlessWebContents> web_contents =
- browser()->CreateWebContents(gfx::Size(800, 600));
-
// Load a page which doesn't actually exist, but for which the our proxy
// returns valid content anyway.
- EXPECT_TRUE(NavigateAndWaitForLoad(
- web_contents.get(), GURL("http://not-an-actual-domain.tld/hello.html")));
+ std::unique_ptr<HeadlessWebContents> web_contents =
+ browser()->CreateWebContents(
+ GURL("http://not-an-actual-domain.tld/hello.html"),
+ gfx::Size(800, 600));
+ EXPECT_TRUE(WaitForLoad(web_contents.get()));
}
} // namespace headless

Powered by Google App Engine
This is Rietveld 408576698