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

Unified Diff: headless/lib/headless_web_contents_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
« no previous file with comments | « headless/lib/headless_devtools_client_browsertest.cc ('k') | headless/public/headless_browser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/headless_web_contents_browsertest.cc
diff --git a/headless/lib/headless_web_contents_browsertest.cc b/headless/lib/headless_web_contents_browsertest.cc
index aaa5491882b03110142178172184bd9ff6f69123..2298b8bcf1326076915b9cbe0199dacb2411cc6e 100644
--- a/headless/lib/headless_web_contents_browsertest.cc
+++ b/headless/lib/headless_web_contents_browsertest.cc
@@ -39,9 +39,8 @@ class NavigationObserver : public HeadlessWebContents::Observer {
IN_PROC_BROWSER_TEST_F(HeadlessWebContentsTest, Navigation) {
EXPECT_TRUE(embedded_test_server()->Start());
- std::unique_ptr<HeadlessWebContents> web_contents =
- browser()->CreateWebContents(
- embedded_test_server()->GetURL("/hello.html"), gfx::Size(800, 600));
+ HeadlessWebContents* web_contents = browser()->CreateWebContents(
+ embedded_test_server()->GetURL("/hello.html"), gfx::Size(800, 600));
NavigationObserver observer(this);
web_contents->AddObserver(&observer);
@@ -49,6 +48,31 @@ IN_PROC_BROWSER_TEST_F(HeadlessWebContentsTest, Navigation) {
EXPECT_TRUE(observer.navigation_succeeded());
web_contents->RemoveObserver(&observer);
+
+ std::vector<HeadlessWebContents*> all_web_contents =
+ browser()->GetAllWebContents();
+
+ EXPECT_EQ(static_cast<size_t>(1), all_web_contents.size());
+ EXPECT_EQ(web_contents, all_web_contents[0]);
+}
+
+IN_PROC_BROWSER_TEST_F(HeadlessWebContentsTest, WindowOpen) {
+ EXPECT_TRUE(embedded_test_server()->Start());
+
+ HeadlessWebContents* web_contents = browser()->CreateWebContents(
+ embedded_test_server()->GetURL("/window_open.html"), gfx::Size(800, 600));
+ NavigationObserver observer(this);
+ web_contents->AddObserver(&observer);
+
+ RunAsynchronousTest();
+
+ EXPECT_TRUE(observer.navigation_succeeded());
+ web_contents->RemoveObserver(&observer);
+
+ std::vector<HeadlessWebContents*> all_web_contents =
+ browser()->GetAllWebContents();
+
+ EXPECT_EQ(static_cast<size_t>(2), all_web_contents.size());
}
} // namespace headless
« no previous file with comments | « headless/lib/headless_devtools_client_browsertest.cc ('k') | headless/public/headless_browser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698