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

Unified Diff: chrome/browser/chrome_content_browser_client_unittest.cc

Issue 897673002: First step in enabling creating tabs without an Activity on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a-base-mounir
Patch Set: rebase Created 5 years, 10 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 | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chrome_content_browser_client_unittest.cc
diff --git a/chrome/browser/chrome_content_browser_client_unittest.cc b/chrome/browser/chrome_content_browser_client_unittest.cc
index 42c45c5f069ae45b63369a33164bbfdf66fd1548..c0235f18e274e1291ec7d7125084765abfef2745 100644
--- a/chrome/browser/chrome_content_browser_client_unittest.cc
+++ b/chrome/browser/chrome_content_browser_client_unittest.cc
@@ -32,11 +32,18 @@ TEST_F(ChromeContentBrowserClientTest, ShouldAssignSiteForURL) {
EXPECT_TRUE(client.ShouldAssignSiteForURL(GURL("https://www.google.com")));
}
-using ChromeContentBrowserClientWindowTest = BrowserWithTestWindowTest;
-
// BrowserWithTestWindowTest doesn't work on iOS and Android.
#if !defined(OS_ANDROID) && !defined(OS_IOS)
+using ChromeContentBrowserClientWindowTest = BrowserWithTestWindowTest;
+
+static void DidOpenURLForWindowTest(content::WebContents** target_contents,
+ content::WebContents* opened_contents) {
+ DCHECK(target_contents);
+
+ *target_contents = opened_contents;
+}
+
// This test opens two URLs using ContentBrowserClient::OpenURL. It expects the
// URLs to be opened in new tabs and activated, changing the active tabs after
// each call and increasing the tab count by 2.
@@ -54,13 +61,20 @@ TEST_F(ChromeContentBrowserClientWindowTest, OpenURL) {
NEW_FOREGROUND_TAB,
ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
false);
- content::WebContents* contents =
- client.OpenURL(browser()->profile(), params);
- EXPECT_TRUE(contents);
+ // TODO(peter): We should have more in-depth browser tests for the window
+ // opening functionality, which also covers Android. This test can currently
+ // only be ran on platforms where OpenURL is implemented synchronously.
+ // See https://crbug.com/457667.
+ content::WebContents* web_contents = nullptr;
+ client.OpenURL(browser()->profile(),
+ params,
+ base::Bind(&DidOpenURLForWindowTest, &web_contents));
+
+ EXPECT_TRUE(web_contents);
content::WebContents* active_contents = browser()->tab_strip_model()->
GetActiveWebContents();
- EXPECT_EQ(contents, active_contents);
+ EXPECT_EQ(web_contents, active_contents);
EXPECT_EQ(url, active_contents->GetVisibleURL());
}
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698