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..201a3398217049321402ec609640eedfc564e383 100644 |
| --- a/chrome/browser/chrome_content_browser_client_unittest.cc |
| +++ b/chrome/browser/chrome_content_browser_client_unittest.cc |
| @@ -32,11 +32,25 @@ 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) |
| +class ChromeContentBrowserClientWindowTest : public BrowserWithTestWindowTest { |
| + public: |
| + ChromeContentBrowserClientWindowTest() |
| + : web_contents_(nullptr) {} |
| + |
| + void DidOpenURL(content::WebContents* web_contents) { |
| + web_contents_ = web_contents; |
| + } |
| + |
| + protected: |
| + content::WebContents* web_contents() const { return web_contents_; } |
| + |
| + private: |
| + content::WebContents* web_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 +68,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. For all platforms but |
| + // Android and iOS this is synchronous, which is the assumption this test |
|
mlamouri (slow - plz ping)
2015/02/09 12:07:37
nit: I wouldn't make any assumption about iOS impl
Peter Beverloo
2015/02/10 17:49:37
Done.
|
| + // currently follows. |
| + client.OpenURL(browser()->profile(), |
| + params, |
| + base::Bind(&ChromeContentBrowserClientWindowTest::DidOpenURL, |
| + base::Unretained(this))); |
| + EXPECT_TRUE(web_contents()); |
|
mlamouri (slow - plz ping)
2015/02/09 12:07:37
It's a bit odd to have web_contents() being a test
Peter Beverloo
2015/02/10 17:49:37
Done.
|
| 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()); |
| } |