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

Unified Diff: headless/lib/headless_browser_browsertest.cc

Issue 1891843004: [headless] AddWindowTreeClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to latest master 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 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
« no previous file with comments | « headless/lib/browser/headless_window_tree_client.cc ('k') | headless/lib/headless_devtools_client_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698