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

Unified Diff: chrome/browser/ui/gtk/one_click_signin_bubble_gtk_browsertest.cc

Issue 10332185: Update behavior of one-click infobar to remove modal dialog, add "undo". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Don't call ok in tests of advanced link Created 8 years, 7 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/gtk/one_click_signin_bubble_gtk_browsertest.cc
diff --git a/chrome/browser/ui/gtk/one_click_signin_bubble_gtk_browsertest.cc b/chrome/browser/ui/gtk/one_click_signin_bubble_gtk_browsertest.cc
index d0b9934d7f66be2f0e39cf66308cdc1af18ff79f..bab8997c709cfdb0e9b75380a0b1bde77a3be5f4 100644
--- a/chrome/browser/ui/gtk/one_click_signin_bubble_gtk_browsertest.cc
+++ b/chrome/browser/ui/gtk/one_click_signin_bubble_gtk_browsertest.cc
@@ -20,58 +20,57 @@ class OneClickSigninBubbleGtkTest : public InProcessBrowserTest {
public:
OneClickSigninBubbleGtkTest()
: weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
- learn_more_callback_(
- base::Bind(&OneClickSigninBubbleGtkTest::OnLearnMore,
- weak_ptr_factory_.GetWeakPtr())),
- advanced_callback_(
- base::Bind(&OneClickSigninBubbleGtkTest::OnAdvanced,
+ start_sync_callback_(
+ base::Bind(&OneClickSigninBubbleGtkTest::OnStartSync,
weak_ptr_factory_.GetWeakPtr())),
bubble_(NULL) {}
virtual OneClickSigninBubbleGtk* MakeBubble() {
return new OneClickSigninBubbleGtk(
static_cast<BrowserWindowGtk*>(browser()->window()),
- learn_more_callback_,
- advanced_callback_);
+ start_sync_callback_);
}
- MOCK_METHOD0(OnLearnMore, void());
- MOCK_METHOD0(OnAdvanced, void());
+ MOCK_METHOD1(OnStartSync, void(bool));
protected:
base::WeakPtrFactory<OneClickSigninBubbleGtkTest> weak_ptr_factory_;
- base::Closure learn_more_callback_;
- base::Closure advanced_callback_;
+ base::Callback<void(bool)> start_sync_callback_;
// Owns itself.
OneClickSigninBubbleGtk* bubble_;
};
-// Test that the dialog doesn't call any callback if the OK button is
-// clicked.
+// Test that the dialog calls the callback if the OK button is clicked.
+// Callback should be called to setup sync with default settings.
IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, ShowAndOK) {
- EXPECT_CALL(*this, OnLearnMore()).Times(0);
- EXPECT_CALL(*this, OnAdvanced()).Times(0);
+ EXPECT_CALL(*this, OnStartSync(true)).Times(1);
MakeBubble()->ClickOKForTest();
}
-// Test that the learn more callback is run if its corresponding
-// button is clicked.
-IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, ShowAndClickLearnMore) {
- EXPECT_CALL(*this, OnLearnMore()).Times(1);
- EXPECT_CALL(*this, OnAdvanced()).Times(0);
+// Test that the dialog doesn't calls the callback if the Undo button is
+// clicked.
+IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, ShowAndUndo) {
+ EXPECT_CALL(*this, OnStartSync(testing::_)).Times(0);
- MakeBubble()->ClickLearnMoreForTest();
+ MakeBubble()->ClickUndoForTest();
}
-// Test that the advanced callback is run if its corresponding button
-// is clicked.
+// Test that the dialog calls the callback if the advanced link is clicked.
+// Callback should be called to configure sync before starting.
IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, ShowAndClickAdvanced) {
- EXPECT_CALL(*this, OnLearnMore()).Times(0);
- EXPECT_CALL(*this, OnAdvanced()).Times(1);
+ EXPECT_CALL(*this, OnStartSync(false)).Times(1);
MakeBubble()->ClickAdvancedForTest();
}
+// Test that the dialog calls the callback if the bubble is closed.
+// Callback should be called to setup sync with default settings.
+IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, ShowAndClose) {
+ EXPECT_CALL(*this, OnStartSync(true)).Times(1);
+
+ MakeBubble()->CloseForTest();
+}
+
} // namespace

Powered by Google App Engine
This is Rietveld 408576698