Disable TabDragController tests that fail with a real compositor.
[chromium-blink-merge.git] / chrome / browser / ui / gtk / one_click_signin_bubble_gtk_browsertest.cc
blobb370a57b05bef66d7b90124a0d0a9e98292e3083
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.
5 #include "chrome/browser/ui/gtk/one_click_signin_bubble_gtk.h"
7 #include <gtk/gtk.h>
9 #include "base/bind.h"
10 #include "base/compiler_specific.h"
11 #include "base/memory/weak_ptr.h"
12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/gtk/browser_window_gtk.h"
14 #include "chrome/browser/ui/sync/one_click_signin_sync_starter.h"
15 #include "chrome/test/base/in_process_browser_test.h"
16 #include "testing/gmock/include/gmock/gmock.h"
18 class OneClickSigninBubbleGtkTest : public InProcessBrowserTest {
19 public:
20 OneClickSigninBubbleGtkTest()
21 : bubble_(NULL),
22 weak_ptr_factory_(this) {
23 start_sync_callback_ = base::Bind(&OneClickSigninBubbleGtkTest::OnStartSync,
24 weak_ptr_factory_.GetWeakPtr());
28 virtual OneClickSigninBubbleGtk* MakeBubble(
29 BrowserWindow::OneClickSigninBubbleType bubbleType) {
30 return new OneClickSigninBubbleGtk(
31 static_cast<BrowserWindowGtk*>(browser()->window()),
32 bubbleType,
33 base::string16(),
34 base::string16(),
35 start_sync_callback_);
38 MOCK_METHOD1(OnStartSync, void(OneClickSigninSyncStarter::StartSyncMode));
40 protected:
41 BrowserWindow::StartSyncCallback start_sync_callback_;
43 // Owns itself.
44 OneClickSigninBubbleGtk* bubble_;
46 base::WeakPtrFactory<OneClickSigninBubbleGtkTest> weak_ptr_factory_;
49 // Test that the dialog calls the callback if the OK button is clicked.
50 // Callback should be called to setup sync with default settings.
51 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, DialogShowAndOK) {
52 EXPECT_CALL(*this, OnStartSync(
53 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS)).Times(1);
55 MakeBubble(
56 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_MODAL_DIALOG)->OnClickOK(NULL);
59 // Test that the dialog calls the callback if the Undo button is
60 // clicked. Callback should be called to abort the sync process.
61 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, DialogShowAndUndo) {
62 EXPECT_CALL(*this, OnStartSync(
63 OneClickSigninSyncStarter::UNDO_SYNC)).Times(1);
65 MakeBubble(BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_MODAL_DIALOG)
66 ->OnClickUndo(NULL);
69 // Test that the dialog calls the callback if the advanced link is clicked.
70 // Callback should be called to configure sync before starting.
71 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, DialogShowAndClickAdvanced){
72 EXPECT_CALL(*this,
73 OnStartSync(OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST)).
74 Times(1);
76 MakeBubble(BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_MODAL_DIALOG)
77 ->OnClickAdvancedLink(NULL);
80 // Test that the dialog calls the callback if the bubble is closed.
81 // Callback should be called to setup sync with default settings.
82 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, DialogShowAndClose) {
83 EXPECT_CALL(*this, OnStartSync(
84 OneClickSigninSyncStarter::UNDO_SYNC)).Times(1);
86 MakeBubble(
87 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_MODAL_DIALOG)->bubble_->Close();
90 // Test that the bubble does not call the callback if the OK button is clicked.
91 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, BubbleShowAndOK) {
92 EXPECT_CALL(*this, OnStartSync(
93 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS)).Times(0);
95 MakeBubble(
96 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE)->OnClickOK(NULL);
99 // Test that the bubble does not call the callback
100 // if the advanced link is clicked.
101 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, BubbleShowAndClickAdvanced){
102 EXPECT_CALL(*this, OnStartSync(
103 OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST)).Times(0);
105 MakeBubble(BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE)
106 ->OnClickAdvancedLink(NULL);
109 // Test that the bubble does not call the callback if the bubble is closed.
110 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleGtkTest, BubbleShowAndClose) {
111 EXPECT_CALL(*this, OnStartSync(
112 OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS)).Times(0);
114 MakeBubble(
115 BrowserWindow::ONE_CLICK_SIGNIN_BUBBLE_TYPE_BUBBLE)->bubble_->Close();