Index: headless/lib/headless_browser_browsertest.cc |
diff --git a/headless/lib/headless_browser_browsertest.cc b/headless/lib/headless_browser_browsertest.cc |
index 9cc594073cef0d6aa78bdb2c4ff4f8c6b55923ad..f7899f24e024bd29856df2aa283c988eff6ea3b8 100644 |
--- a/headless/lib/headless_browser_browsertest.cc |
+++ b/headless/lib/headless_browser_browsertest.cc |
@@ -15,18 +15,24 @@ |
namespace headless { |
IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, CreateAndDestroyWebContents) { |
- std::unique_ptr<HeadlessWebContents> web_contents = |
+ HeadlessWebContents* web_contents = |
browser()->CreateWebContents(GURL("about:blank"), gfx::Size(800, 600)); |
EXPECT_TRUE(web_contents); |
+ |
+ EXPECT_EQ(static_cast<size_t>(1), browser()->GetAllWebContents().size()); |
+ EXPECT_EQ(web_contents, browser()->GetAllWebContents()[0]); |
// TODO(skyostil): Verify viewport dimensions once we can. |
- web_contents.reset(); |
+ web_contents->Close(); |
+ |
+ EXPECT_TRUE(browser()->GetAllWebContents().empty()); |
} |
IN_PROC_BROWSER_TEST_F(HeadlessBrowserTest, CreateWithBadURL) { |
GURL bad_url("not_valid"); |
- std::unique_ptr<HeadlessWebContents> web_contents = |
+ HeadlessWebContents* web_contents = |
browser()->CreateWebContents(bad_url, gfx::Size(800, 600)); |
EXPECT_FALSE(web_contents); |
+ EXPECT_TRUE(browser()->GetAllWebContents().empty()); |
} |
class HeadlessBrowserTestWithProxy : public HeadlessBrowserTest { |
@@ -60,11 +66,16 @@ IN_PROC_BROWSER_TEST_F(HeadlessBrowserTestWithProxy, SetProxyServer) { |
// Load a page which doesn't actually exist, but for which the our proxy |
// returns valid content anyway. |
- 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())); |
+ // |
+ // TODO(altimin): Currently this construction does not serve hello.html |
+ // from headless/test/data as expected. We should fix this. |
+ HeadlessWebContents* web_contents = browser()->CreateWebContents( |
+ GURL("http://not-an-actual-domain.tld/hello.html"), gfx::Size(800, 600)); |
+ EXPECT_TRUE(WaitForLoad(web_contents)); |
+ EXPECT_EQ(static_cast<size_t>(1), browser()->GetAllWebContents().size()); |
+ EXPECT_EQ(web_contents, browser()->GetAllWebContents()[0]); |
+ web_contents->Close(); |
+ EXPECT_TRUE(browser()->GetAllWebContents().empty()); |
} |
} // namespace headless |