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

Side by Side Diff: chrome/browser/ui/gtk/one_click_signin_dialog_gtk_unittest.cc

Issue 9964001: Revert 129762 - [Sync] [GTK] Add GTK version of the one-click signin dialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/gtk/one_click_signin_dialog_gtk.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/gtk/one_click_signin_dialog_gtk.h"
6
7 #include <gtk/gtk.h>
8
9 #include "base/bind.h"
10 #include "base/compiler_specific.h"
11 #include "base/memory/weak_ptr.h"
12 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14
15 namespace {
16
17 using ::testing::_;
18
19 class OneClickSigninDialogGtkTest : public ::testing::Test {
20 public:
21 OneClickSigninDialogGtkTest()
22 : weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
23 accept_callback_(
24 base::Bind(&OneClickSigninDialogGtkTest::OnAccept,
25 weak_ptr_factory_.GetWeakPtr())),
26 dialog_(new OneClickSigninDialogGtk(NULL, accept_callback_)) {
27 }
28
29 MOCK_METHOD1(OnAccept, void(bool));
30
31 protected:
32 base::WeakPtrFactory<OneClickSigninDialogGtkTest> weak_ptr_factory_;
33 OneClickAcceptCallback accept_callback_;
34 // Owns itself.
35 OneClickSigninDialogGtk* dialog_;
36 };
37
38 // Test that the dialog doesn't call its accept callback if it is
39 // cancelled.
40 TEST_F(OneClickSigninDialogGtkTest, RunAndCancel) {
41 EXPECT_CALL(*this, OnAccept(_)).Times(0);
42
43 dialog_->SendResponseForTest(GTK_RESPONSE_CLOSE);
44 }
45
46 // Test that the dialog calls its accept callback with
47 // use_default_settings=true if it is accepted without changing the
48 // corresponding checkbox state.
49 TEST_F(OneClickSigninDialogGtkTest, RunAndAcceptWithDefaultSettings) {
50 EXPECT_CALL(*this, OnAccept(true));
51
52 dialog_->SendResponseForTest(GTK_RESPONSE_ACCEPT);
53 }
54
55 // Test that the dialog calls its accept callback with
56 // use_default_settings=false if it is accepted after unchecking the
57 // corresponding checkbox.
58 TEST_F(OneClickSigninDialogGtkTest, RunAndAcceptWithoutDefaultSettings) {
59 EXPECT_CALL(*this, OnAccept(false));
60
61 dialog_->SetUseDefaultSettingsForTest(false);
62 dialog_->SendResponseForTest(GTK_RESPONSE_ACCEPT);
63 }
64
65 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/one_click_signin_dialog_gtk.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698