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

Unified Diff: chrome/browser/ui/views/bookmarks/bookmark_bubble_sign_in_delegate_browsertest.cc

Issue 2148293003: Excluded non-chromeos source files in chromeos build (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Modified BUILD.gn Created 4 years, 5 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 | « no previous file | chrome/browser/ui/views/frame/browser_view.cc » ('j') | chrome/chrome_tests.gypi » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/bookmarks/bookmark_bubble_sign_in_delegate_browsertest.cc
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_bubble_sign_in_delegate_browsertest.cc b/chrome/browser/ui/views/bookmarks/bookmark_bubble_sign_in_delegate_browsertest.cc
index 253378424b4c308f5e24e7fc537dd6af29e20a6f..bf7e2679fa06f3abd2f606a18aa570334ac87fa3 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_bubble_sign_in_delegate_browsertest.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_bubble_sign_in_delegate_browsertest.cc
@@ -18,7 +18,6 @@
#include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/browser/ui/sync/bubble_sync_promo_delegate.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"
@@ -28,10 +27,8 @@
#include "ui/events/event_constants.h"
#include "ui/gfx/range/range.h"
-#if defined(OS_CHROMEOS)
-const bool kHasProfileChooser = false;
-#else
-const bool kHasProfileChooser = true;
+#if !defined(OS_CHROMEOS)
+#include "chrome/browser/ui/views/profiles/profile_chooser_view.h"
#endif
class BookmarkBubbleSignInDelegateTest : public InProcessBrowserTest {
@@ -42,6 +39,9 @@ class BookmarkBubbleSignInDelegateTest : public InProcessBrowserTest {
void ReplaceBlank(Browser* browser);
+ void SignInBrowser(Browser* browser);
+ void CreateRemoveSigninBrowser(Browser* last_active);
msw 2016/07/19 18:51:04 This name is a bit confusing, and it seems like yo
Jane 2016/07/19 21:29:56 Done. Removed this and put the code back.
+
private:
DISALLOW_COPY_AND_ASSIGN(BookmarkBubbleSignInDelegateTest);
};
@@ -57,73 +57,83 @@ void BookmarkBubbleSignInDelegateTest::ReplaceBlank(Browser* browser) {
chrome::ShowSingletonTabOverwritingNTP(browser, params);
}
-IN_PROC_BROWSER_TEST_F(BookmarkBubbleSignInDelegateTest, OnSignInLinkClicked) {
- ReplaceBlank(browser());
- int starting_tab_count = browser()->tab_strip_model()->count();
+void BookmarkBubbleSignInDelegateTest::SignInBrowser(Browser* browser) {
+ std::unique_ptr<BubbleSyncPromoDelegate> delegate;
+ delegate.reset(new BookmarkBubbleSignInDelegate(browser));
+ delegate->OnSignInLinkClicked();
+}
+void BookmarkBubbleSignInDelegateTest::CreateRemoveSigninBrowser(
+ Browser* last_active) {
std::unique_ptr<BubbleSyncPromoDelegate> delegate;
delegate.reset(new BookmarkBubbleSignInDelegate(browser()));
+ BrowserList::SetLastActive(last_active);
+
+ // Close all tabs in the original browser. Run all pending messages to make
+ // sure the browser window closes before continuing.
+ browser()->tab_strip_model()->CloseAllTabs();
+ content::RunAllPendingInMessageLoop();
+
delegate->OnSignInLinkClicked();
+}
- if (kHasProfileChooser) {
- if (switches::UsePasswordSeparatedSigninFlow()) {
- EXPECT_TRUE(browser()->signin_view_controller()->delegate());
- } else {
- EXPECT_TRUE(ProfileChooserView::IsShowing());
- }
+IN_PROC_BROWSER_TEST_F(BookmarkBubbleSignInDelegateTest, OnSignInLinkClicked) {
+ ReplaceBlank(browser());
+ int starting_tab_count = browser()->tab_strip_model()->count();
+ SignInBrowser(browser());
- EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count());
+#if !defined(OS_CHROMEOS)
+ if (switches::UsePasswordSeparatedSigninFlow()) {
msw 2016/07/19 18:51:04 optional nit: drop all these unnecessary curly bra
Jane 2016/07/19 21:29:56 Done.
+ EXPECT_TRUE(browser()->signin_view_controller()->delegate());
} else {
- EXPECT_EQ(starting_tab_count + 1, browser()->tab_strip_model()->count());
+ EXPECT_TRUE(ProfileChooserView::IsShowing());
}
+
+ EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count());
+#else
+ EXPECT_EQ(starting_tab_count + 1, browser()->tab_strip_model()->count());
+#endif
}
IN_PROC_BROWSER_TEST_F(BookmarkBubbleSignInDelegateTest,
OnSignInLinkClickedReusesBlank) {
int starting_tab_count = browser()->tab_strip_model()->count();
+ SignInBrowser(browser());
- std::unique_ptr<BubbleSyncPromoDelegate> delegate;
- delegate.reset(new BookmarkBubbleSignInDelegate(browser()));
-
- delegate->OnSignInLinkClicked();
-
- if (kHasProfileChooser) {
- if (switches::UsePasswordSeparatedSigninFlow()) {
- EXPECT_TRUE(browser()->signin_view_controller()->delegate());
- } else {
- EXPECT_TRUE(ProfileChooserView::IsShowing());
- }
-
- EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count());
+#if !defined(OS_CHROMEOS)
+ if (switches::UsePasswordSeparatedSigninFlow()) {
+ EXPECT_TRUE(browser()->signin_view_controller()->delegate());
} else {
- EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count());
+ EXPECT_TRUE(ProfileChooserView::IsShowing());
}
+
+ EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count());
+#else
+ EXPECT_EQ(starting_tab_count, browser()->tab_strip_model()->count());
+#endif
}
IN_PROC_BROWSER_TEST_F(BookmarkBubbleSignInDelegateTest,
OnSignInLinkClickedIncognito) {
ReplaceBlank(browser());
Browser* incognito_browser = CreateIncognitoBrowser();
-
- int starting_tab_count_normal = browser()->tab_strip_model()->count();
int starting_tab_count_incognito =
incognito_browser->tab_strip_model()->count();
- std::unique_ptr<BubbleSyncPromoDelegate> delegate;
- delegate.reset(new BookmarkBubbleSignInDelegate(incognito_browser));
-
- delegate->OnSignInLinkClicked();
+#if !defined(OS_CHROMEOS)
+ SignInBrowser(incognito_browser);
+ // ProfileChooser doesn't show in an incognito window.
+ EXPECT_FALSE(ProfileChooserView::IsShowing());
+#else
+ int starting_tab_count_normal = browser()->tab_strip_model()->count();
msw 2016/07/19 18:51:04 Leave this above, with the call to SignInBrowser,
Jane 2016/07/19 21:29:56 Done.
+ SignInBrowser(incognito_browser);
- if (kHasProfileChooser) {
- // ProfileChooser doesn't show in an incognito window.
- EXPECT_FALSE(ProfileChooserView::IsShowing());
- } else {
- // A new tab should have been opened in the normal browser, which should be
- // visible.
- int tab_count_normal = browser()->tab_strip_model()->count();
- EXPECT_EQ(starting_tab_count_normal + 1, tab_count_normal);
- }
+ // A new tab should have been opened in the normal browser, which should be
+ // visible.
+ int tab_count_normal = browser()->tab_strip_model()->count();
+ EXPECT_EQ(starting_tab_count_normal + 1, tab_count_normal);
+#endif
// 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);
@@ -136,30 +146,19 @@ IN_PROC_BROWSER_TEST_F(BookmarkBubbleSignInDelegateTest, BrowserRemoved) {
Browser* extra_browser = CreateBrowser(profile());
ReplaceBlank(extra_browser);
- int starting_tab_count = extra_browser->tab_strip_model()->count();
-
- std::unique_ptr<BubbleSyncPromoDelegate> delegate;
- delegate.reset(new BookmarkBubbleSignInDelegate(browser()));
-
- BrowserList::SetLastActive(extra_browser);
-
- // Close all tabs in the original browser. Run all pending messages
- // to make sure the browser window closes before continuing.
- browser()->tab_strip_model()->CloseAllTabs();
- content::RunAllPendingInMessageLoop();
-
- delegate->OnSignInLinkClicked();
-
- if (kHasProfileChooser) {
- if (switches::UsePasswordSeparatedSigninFlow()) {
- EXPECT_TRUE(extra_browser->signin_view_controller()->delegate());
- } else {
- EXPECT_TRUE(ProfileChooserView::IsShowing());
- }
+#if !defined(OS_CHROMEOS)
+ CreateRemoveSigninBrowser(extra_browser);
+ if (switches::UsePasswordSeparatedSigninFlow()) {
+ EXPECT_TRUE(extra_browser->signin_view_controller()->delegate());
} else {
- // 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);
+ EXPECT_TRUE(ProfileChooserView::IsShowing());
}
+#else
+ int starting_tab_count = extra_browser->tab_strip_model()->count();
msw 2016/07/19 18:51:04 Try to avoid some of this refactoring. You should
Jane 2016/07/19 21:29:56 Done. I did that much refactoring in an attempt to
+ CreateRemoveSigninBrowser(extra_browser);
+ // 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);
+#endif
}
« no previous file with comments | « no previous file | chrome/browser/ui/views/frame/browser_view.cc » ('j') | chrome/chrome_tests.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698