OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h" | 5 #include "chrome/browser/ui/views/sync/one_click_signin_bubble_view.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_window.h" | 9 #include "chrome/browser/ui/browser_window.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 } | 42 } |
43 | 43 |
44 protected: | 44 protected: |
45 bool on_start_sync_called_; | 45 bool on_start_sync_called_; |
46 OneClickSigninSyncStarter::StartSyncMode mode_; | 46 OneClickSigninSyncStarter::StartSyncMode mode_; |
47 | 47 |
48 private: | 48 private: |
49 DISALLOW_COPY_AND_ASSIGN(OneClickSigninBubbleViewBrowserTest); | 49 DISALLOW_COPY_AND_ASSIGN(OneClickSigninBubbleViewBrowserTest); |
50 }; | 50 }; |
51 | 51 |
52 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, Show) { | 52 // Disabled. See http://crbug.com/132348 |
| 53 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, DISABLED_Show) { |
53 ShowOneClickSigninBubble(); | 54 ShowOneClickSigninBubble(); |
54 ui_test_utils::RunAllPendingInMessageLoop(); | 55 ui_test_utils::RunAllPendingInMessageLoop(); |
55 EXPECT_TRUE(OneClickSigninBubbleView::IsShowing()); | 56 EXPECT_TRUE(OneClickSigninBubbleView::IsShowing()); |
56 | 57 |
57 OneClickSigninBubbleView::Hide(); | 58 OneClickSigninBubbleView::Hide(); |
58 ui_test_utils::RunAllPendingInMessageLoop(); | 59 ui_test_utils::RunAllPendingInMessageLoop(); |
59 EXPECT_TRUE(on_start_sync_called_); | 60 EXPECT_TRUE(on_start_sync_called_); |
60 EXPECT_EQ(OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, mode_); | 61 EXPECT_EQ(OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, mode_); |
61 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); | 62 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); |
62 } | 63 } |
63 | 64 |
64 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, OkButton) { | 65 // Disabled. See http://crbug.com/132348 |
| 66 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, DISABLED_OkButton) { |
65 OneClickSigninBubbleView* view = ShowOneClickSigninBubble(); | 67 OneClickSigninBubbleView* view = ShowOneClickSigninBubble(); |
66 | 68 |
67 // Simulate pressing the OK button. Set the message loop in the bubble | 69 // Simulate pressing the OK button. Set the message loop in the bubble |
68 // view so that it can be quit once the bubble is hidden. | 70 // view so that it can be quit once the bubble is hidden. |
69 views::ButtonListener* listener = view; | 71 views::ButtonListener* listener = view; |
70 const views::MouseEvent event(ui::ET_MOUSE_PRESSED, 0, 0, 0); | 72 const views::MouseEvent event(ui::ET_MOUSE_PRESSED, 0, 0, 0); |
71 listener->ButtonPressed(view->ok_button_, event); | 73 listener->ButtonPressed(view->ok_button_, event); |
72 | 74 |
73 // View should no longer be showing. The message loop will exit once the | 75 // View should no longer be showing. The message loop will exit once the |
74 // fade animation of the bubble is done. | 76 // fade animation of the bubble is done. |
75 ui_test_utils::RunMessageLoop(); | 77 ui_test_utils::RunMessageLoop(); |
76 EXPECT_TRUE(on_start_sync_called_); | 78 EXPECT_TRUE(on_start_sync_called_); |
77 EXPECT_EQ(OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, mode_); | 79 EXPECT_EQ(OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, mode_); |
78 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); | 80 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); |
79 } | 81 } |
80 | 82 |
81 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, UndoButton) { | 83 // Disabled. See http://crbug.com/132348 |
| 84 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, |
| 85 DISABLED_UndoButton) { |
82 OneClickSigninBubbleView* view = ShowOneClickSigninBubble(); | 86 OneClickSigninBubbleView* view = ShowOneClickSigninBubble(); |
83 | 87 |
84 // Simulate pressing the undo button. Set the message loop in the bubble | 88 // Simulate pressing the undo button. Set the message loop in the bubble |
85 // view so that it can be quit once the bubble is hidden. | 89 // view so that it can be quit once the bubble is hidden. |
86 views::ButtonListener* listener = view; | 90 views::ButtonListener* listener = view; |
87 const views::MouseEvent event(ui::ET_MOUSE_PRESSED, 0, 0, 0); | 91 const views::MouseEvent event(ui::ET_MOUSE_PRESSED, 0, 0, 0); |
88 listener->ButtonPressed(view->undo_button_, event); | 92 listener->ButtonPressed(view->undo_button_, event); |
89 | 93 |
90 // View should no longer be showing. The message loop will exit once the | 94 // View should no longer be showing. The message loop will exit once the |
91 // fade animation of the bubble is done. | 95 // fade animation of the bubble is done. |
92 ui_test_utils::RunMessageLoop(); | 96 ui_test_utils::RunMessageLoop(); |
93 EXPECT_FALSE(on_start_sync_called_); | 97 EXPECT_FALSE(on_start_sync_called_); |
94 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); | 98 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); |
95 } | 99 } |
96 | 100 |
97 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, AdvancedLink) { | 101 // Disabled. See http://crbug.com/132348 |
| 102 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, |
| 103 DISABLED_AdvancedLink) { |
98 OneClickSigninBubbleView* view = ShowOneClickSigninBubble(); | 104 OneClickSigninBubbleView* view = ShowOneClickSigninBubble(); |
99 | 105 |
100 // Simulate pressing a link in the bubble. This should open a new tab. | 106 // Simulate pressing a link in the bubble. This should open a new tab. |
101 views::LinkListener* listener = view; | 107 views::LinkListener* listener = view; |
102 listener->LinkClicked(view->advanced_link_, 0); | 108 listener->LinkClicked(view->advanced_link_, 0); |
103 | 109 |
104 // View should no longer be showing and a new tab should be opened. | 110 // View should no longer be showing and a new tab should be opened. |
105 ui_test_utils::RunMessageLoop(); | 111 ui_test_utils::RunMessageLoop(); |
106 EXPECT_TRUE(on_start_sync_called_); | 112 EXPECT_TRUE(on_start_sync_called_); |
107 EXPECT_EQ(OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST, mode_); | 113 EXPECT_EQ(OneClickSigninSyncStarter::CONFIGURE_SYNC_FIRST, mode_); |
108 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); | 114 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); |
109 } | 115 } |
110 | 116 |
111 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, PressEnterKey) { | 117 // Disabled. See http://crbug.com/132348 |
| 118 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, |
| 119 DISABLED_PressEnterKey) { |
112 OneClickSigninBubbleView* one_click_view = ShowOneClickSigninBubble(); | 120 OneClickSigninBubbleView* one_click_view = ShowOneClickSigninBubble(); |
113 | 121 |
114 // Simulate pressing the Enter key. | 122 // Simulate pressing the Enter key. |
115 views::View* view = one_click_view; | 123 views::View* view = one_click_view; |
116 const ui::Accelerator accelerator(ui::VKEY_RETURN, 0); | 124 const ui::Accelerator accelerator(ui::VKEY_RETURN, 0); |
117 view->AcceleratorPressed(accelerator); | 125 view->AcceleratorPressed(accelerator); |
118 | 126 |
119 // View should no longer be showing. The message loop will exit once the | 127 // View should no longer be showing. The message loop will exit once the |
120 // fade animation of the bubble is done. | 128 // fade animation of the bubble is done. |
121 ui_test_utils::RunMessageLoop(); | 129 ui_test_utils::RunMessageLoop(); |
122 EXPECT_TRUE(on_start_sync_called_); | 130 EXPECT_TRUE(on_start_sync_called_); |
123 EXPECT_EQ(OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, mode_); | 131 EXPECT_EQ(OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS, mode_); |
124 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); | 132 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); |
125 } | 133 } |
126 | 134 |
127 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, PressEscapeKey) { | 135 // Disabled. See http://crbug.com/132348 |
| 136 IN_PROC_BROWSER_TEST_F(OneClickSigninBubbleViewBrowserTest, |
| 137 DISABLED_PressEscapeKey) { |
128 OneClickSigninBubbleView* one_click_view = ShowOneClickSigninBubble(); | 138 OneClickSigninBubbleView* one_click_view = ShowOneClickSigninBubble(); |
129 | 139 |
130 // Simulate pressing the Escape key. | 140 // Simulate pressing the Escape key. |
131 views::View* view = one_click_view; | 141 views::View* view = one_click_view; |
132 const ui::Accelerator accelerator(ui::VKEY_ESCAPE, 0); | 142 const ui::Accelerator accelerator(ui::VKEY_ESCAPE, 0); |
133 view->AcceleratorPressed(accelerator); | 143 view->AcceleratorPressed(accelerator); |
134 | 144 |
135 // View should no longer be showing. The message loop will exit once the | 145 // View should no longer be showing. The message loop will exit once the |
136 // fade animation of the bubble is done. | 146 // fade animation of the bubble is done. |
137 ui_test_utils::RunMessageLoop(); | 147 ui_test_utils::RunMessageLoop(); |
138 EXPECT_FALSE(on_start_sync_called_); | 148 EXPECT_FALSE(on_start_sync_called_); |
139 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); | 149 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); |
140 } | 150 } |
OLD | NEW |