Index: chrome/browser/ui/views/bookmarks/bookmark_bubble_sign_in_delegate_browsertest.cc |
diff --git a/chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate_browsertest.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_sign_in_delegate_browsertest.cc |
similarity index 73% |
rename from chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate_browsertest.cc |
rename to chrome/browser/ui/views/bookmarks/bookmark_bubble_sign_in_delegate_browsertest.cc |
index 536c1eafb699cfc3328e1b5d552f8087ae1f84b1..f19c3d0c2f8f310db8fb3d70ea485753a2c6f6d4 100644 |
--- a/chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate_browsertest.cc |
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_sign_in_delegate_browsertest.cc |
@@ -15,6 +15,7 @@ |
#include "chrome/browser/ui/browser_list.h" |
#include "chrome/browser/ui/singleton_tabs.h" |
#include "chrome/browser/ui/tabs/tab_strip_model.h" |
+#include "chrome/browser/ui/views/profiles/profile_chooser_view.h" |
#include "chrome/common/chrome_switches.h" |
#include "chrome/test/base/in_process_browser_test.h" |
#include "chrome/test/base/testing_profile.h" |
@@ -23,6 +24,7 @@ |
#include "ui/events/event_constants.h" |
#include "ui/gfx/range/range.h" |
+ |
sky
2015/03/09 15:54:20
nit: remove this newline.
Mike Lerman
2015/03/10 15:58:58
Done.
|
class BookmarkBubbleSignInDelegateTest : public InProcessBrowserTest { |
public: |
BookmarkBubbleSignInDelegateTest() {} |
@@ -31,6 +33,8 @@ class BookmarkBubbleSignInDelegateTest : public InProcessBrowserTest { |
void ReplaceBlank(Browser* browser); |
+ void ExpectProfileChooserShows(bool shows); |
+ |
private: |
DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleSignInDelegateTest); |
}; |
@@ -46,6 +50,15 @@ void BookmarkBubbleSignInDelegateTest::ReplaceBlank(Browser* browser) { |
chrome::ShowSingletonTabOverwritingNTP(browser, params); |
} |
+void BookmarkBubbleSignInDelegateTest::ExpectProfileChooserShows(bool shows) { |
+ base::MessageLoop::current()->RunUntilIdle(); |
sky
2015/03/09 15:54:20
We do you need the RunUntilIdle?
The pattern you
Mike Lerman
2015/03/10 15:58:58
We don't need the Runloop();. I thought we didn't,
|
+ // There's no good way, across platforms, to determine if the User Menu shows. |
+ // Verify for Views, and otherwise we just check nothing crashed. |
+#if defined(TOOLKIT_VIEWS) |
+ EXPECT_EQ(shows, ProfileChooserView::IsShowing()); |
+#endif |
+} |
+ |
IN_PROC_BROWSER_TEST_F(BookmarkBubbleSignInDelegateTest, OnSignInLinkClicked) { |
ReplaceBlank(browser()); |
int starting_tab_count = browser()->tab_strip_model()->count(); |
@@ -55,8 +68,14 @@ IN_PROC_BROWSER_TEST_F(BookmarkBubbleSignInDelegateTest, OnSignInLinkClicked) { |
delegate->OnSignInLinkClicked(); |
- // A new tab should have been opened and the browser should be visible. |
+#if defined(OS_CHROMEOS) |
sky
2015/03/09 15:54:20
All these ifdefs make it hard to follow. I think i
Mike Lerman
2015/03/10 15:58:58
Done.
|
+ // ChromeOS has no Profile Chooser; signin happens in a full tab. |
EXPECT_EQ(starting_tab_count + 1, browser()->tab_strip_model()->count()); |
+#else |
+ // The browser remains visible and the Profile Chooser shows. |
+ ExpectProfileChooserShows(true); |
+ EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count()); |
+#endif |
} |
IN_PROC_BROWSER_TEST_F(BookmarkBubbleSignInDelegateTest, |
@@ -68,8 +87,14 @@ IN_PROC_BROWSER_TEST_F(BookmarkBubbleSignInDelegateTest, |
delegate->OnSignInLinkClicked(); |
- // A new tab should have been opened and the browser should be visible. |
+#if defined(OS_CHROMEOS) |
+ // ChromeOS has no Profile Chooser; signin happens in a full tab. |
+ EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count()); |
+#else |
+ // The browser remains visible and the Profile Chooser shows. |
+ ExpectProfileChooserShows(true); |
EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count()); |
+#endif |
} |
IN_PROC_BROWSER_TEST_F(BookmarkBubbleSignInDelegateTest, |
@@ -77,7 +102,9 @@ IN_PROC_BROWSER_TEST_F(BookmarkBubbleSignInDelegateTest, |
ReplaceBlank(browser()); |
Browser* incognito_browser = CreateIncognitoBrowser(); |
+#if defined(OS_CHROMEOS) |
int starting_tab_count_normal = browser()->tab_strip_model()->count(); |
+#endif |
int starting_tab_count_incognito = |
incognito_browser->tab_strip_model()->count(); |
@@ -86,6 +113,9 @@ IN_PROC_BROWSER_TEST_F(BookmarkBubbleSignInDelegateTest, |
delegate->OnSignInLinkClicked(); |
+ |
+#if defined(OS_CHROMEOS) |
+ // ChromeOS has no Profile Chooser; signin happens in a full tab. |
// A new tab should have been opened in the normal browser, which should be |
// visible. |
int tab_count_normal = browser()->tab_strip_model()->count(); |
@@ -94,8 +124,15 @@ IN_PROC_BROWSER_TEST_F(BookmarkBubbleSignInDelegateTest, |
// No effect is expected on the incognito browser. |
int tab_count_incognito = incognito_browser->tab_strip_model()->count(); |
EXPECT_EQ(starting_tab_count_incognito, tab_count_incognito); |
-} |
+#else |
+ // ProfileChooser doesn't show in an incognito window. |
+ ExpectProfileChooserShows(false); |
+ // No effect is expected on the incognito browser. |
+ int tab_count_incognito = incognito_browser->tab_strip_model()->count(); |
+ EXPECT_EQ(starting_tab_count_incognito, tab_count_incognito); |
+#endif |
+} |
// Verifies that the sign in page can be loaded in a different browser |
// if the provided browser is invalidated. |
IN_PROC_BROWSER_TEST_F(BookmarkBubbleSignInDelegateTest, BrowserRemoved) { |
@@ -103,7 +140,9 @@ IN_PROC_BROWSER_TEST_F(BookmarkBubbleSignInDelegateTest, BrowserRemoved) { |
Browser* extra_browser = CreateBrowser(profile()); |
ReplaceBlank(extra_browser); |
+#if defined(OS_CHROMEOS) |
int starting_tab_count = extra_browser->tab_strip_model()->count(); |
+#endif |
scoped_ptr<BookmarkBubbleDelegate> delegate; |
delegate.reset(new BookmarkBubbleSignInDelegate(browser())); |
@@ -117,8 +156,14 @@ IN_PROC_BROWSER_TEST_F(BookmarkBubbleSignInDelegateTest, BrowserRemoved) { |
delegate->OnSignInLinkClicked(); |
+#if defined(OS_CHROMEOS) |
+ // ChromeOS has no Profile Chooser; signin happens in a full tab. |
// A new tab should have been opened in the extra browser, which should be |
// visible. |
int tab_count = extra_browser->tab_strip_model()->count(); |
EXPECT_EQ(starting_tab_count + 1, tab_count); |
+#else |
+ // The Profile Chooser shows in a browser. |
+ ExpectProfileChooserShows(true); |
+#endif |
} |