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

Unified Diff: chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate_unittest.cc

Issue 18603006: Bookmark sync promo for Views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test for CrOS Created 7 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
Index: chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate_unittest.cc
diff --git a/chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate_unittest.cc b/chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f15b0079df20240ed133b123cc89d3c6ee7d4efa
--- /dev/null
+++ b/chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate_unittest.cc
@@ -0,0 +1,62 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h"
+
+#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/ui/bookmarks/bookmark_bubble_delegate.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/test/base/browser_with_test_window_test.h"
+#include "ui/base/events/event_constants.h"
+#include "ui/base/range/range.h"
+
+typedef BrowserWithTestWindowTest BookmarkBubbleSignInDelegateTest;
+
+TEST_F(BookmarkBubbleSignInDelegateTest, OnSignInLinkClicked) {
+ int starting_tab_count = browser()->tab_strip_model()->count();
+
+ scoped_ptr<BookmarkBubbleDelegate> delegate;
+ delegate.reset(new BookmarkBubbleSignInDelegate(browser()));
+
+ delegate->OnSignInLinkClicked();
+
+ // A new tab should have been opened.
+ int tab_count = browser()->tab_strip_model()->count();
+ EXPECT_EQ(starting_tab_count + 1, tab_count);
+}
+
+// Verifies that the sign in page can be loaded in a different browser
+// if the provided browser is invalidated.
+TEST_F(BookmarkBubbleSignInDelegateTest, BrowserRemoved) {
+ // Create an extra browser.
+ scoped_ptr<BrowserWindow> extra_window;
+ extra_window.reset(CreateBrowserWindow());
+
+ Browser::CreateParams params(browser()->profile(),
+ browser()->host_desktop_type());
+ params.window = extra_window.get();
+ scoped_ptr<Browser> extra_browser;
+ extra_browser.reset(new Browser(params));
+
+ int starting_tab_count = extra_browser->tab_strip_model()->count();
+
+ scoped_ptr<BookmarkBubbleDelegate> delegate;
+ delegate.reset(new BookmarkBubbleSignInDelegate(browser()));
+
+ BrowserList::SetLastActive(extra_browser.get());
+
+ browser()->tab_strip_model()->CloseAllTabs();
+ set_browser(NULL);
+
+ delegate->OnSignInLinkClicked();
+
+ // A new tab should have been opened in the extra browser.
+ int tab_count = extra_browser->tab_strip_model()->count();
+ EXPECT_EQ(starting_tab_count + 1, tab_count);
+
+ // Required to avoid a crash when the browser is deleted.
+ extra_browser->tab_strip_model()->CloseAllTabs();
+}
« no previous file with comments | « chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.cc ('k') | chrome/browser/ui/sync/one_click_signin_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698