Chromium Code Reviews| 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..12be00b4cc5289fd0c27ba12b2848e8ad85ff3a4 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,19 @@ 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. |
|
mlamouri (slow - plz ping)
2015/02/11 13:50:23
nit: mind opening a bug?
Peter Beverloo
2015/02/11 16:18:27
Done.
|
| + 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()); |
| } |