| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/ui/sync/one_click_signin_bubble_delegate.h" | 13 #include "chrome/browser/ui/sync/one_click_signin_bubble_delegate.h" |
| 12 #include "content/public/test/test_utils.h" | 14 #include "content/public/test/test_utils.h" |
| 13 #include "ui/events/event_utils.h" | 15 #include "ui/events/event_utils.h" |
| 14 #include "ui/views/controls/button/label_button.h" | 16 #include "ui/views/controls/button/label_button.h" |
| 15 #include "ui/views/test/views_test_base.h" | 17 #include "ui/views/test/views_test_base.h" |
| 16 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 45 } | 47 } |
| 46 | 48 |
| 47 protected: | 49 protected: |
| 48 OneClickSigninBubbleView* ShowOneClickSigninBubble( | 50 OneClickSigninBubbleView* ShowOneClickSigninBubble( |
| 49 BrowserWindow::OneClickSigninBubbleType bubble_type) { | 51 BrowserWindow::OneClickSigninBubbleType bubble_type) { |
| 50 | 52 |
| 51 scoped_ptr<OneClickSigninBubbleDelegate> delegate; | 53 scoped_ptr<OneClickSigninBubbleDelegate> delegate; |
| 52 delegate.reset(new OneClickSigninBubbleTestDelegate(this)); | 54 delegate.reset(new OneClickSigninBubbleTestDelegate(this)); |
| 53 | 55 |
| 54 OneClickSigninBubbleView::ShowBubble( | 56 OneClickSigninBubbleView::ShowBubble( |
| 55 bubble_type, | 57 bubble_type, base::string16(), base::string16(), std::move(delegate), |
| 56 base::string16(), | |
| 57 base::string16(), | |
| 58 delegate.Pass(), | |
| 59 anchor_widget_->GetContentsView(), | 58 anchor_widget_->GetContentsView(), |
| 60 base::Bind(&OneClickSigninBubbleViewTest::OnStartSync, | 59 base::Bind(&OneClickSigninBubbleViewTest::OnStartSync, |
| 61 base::Unretained(this))); | 60 base::Unretained(this))); |
| 62 | 61 |
| 63 OneClickSigninBubbleView* view = | 62 OneClickSigninBubbleView* view = |
| 64 OneClickSigninBubbleView::view_for_testing(); | 63 OneClickSigninBubbleView::view_for_testing(); |
| 65 EXPECT_TRUE(view != NULL); | 64 EXPECT_TRUE(view != NULL); |
| 66 return view; | 65 return view; |
| 67 } | 66 } |
| 68 | 67 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 const ui::Accelerator accelerator(ui::VKEY_ESCAPE, 0); | 313 const ui::Accelerator accelerator(ui::VKEY_ESCAPE, 0); |
| 315 view->AcceleratorPressed(accelerator); | 314 view->AcceleratorPressed(accelerator); |
| 316 | 315 |
| 317 // View should no longer be showing. The message loop will exit once the | 316 // View should no longer be showing. The message loop will exit once the |
| 318 // fade animation of the bubble is done. | 317 // fade animation of the bubble is done. |
| 319 content::RunAllPendingInMessageLoop(); | 318 content::RunAllPendingInMessageLoop(); |
| 320 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); | 319 EXPECT_FALSE(OneClickSigninBubbleView::IsShowing()); |
| 321 EXPECT_TRUE(on_start_sync_called_); | 320 EXPECT_TRUE(on_start_sync_called_); |
| 322 EXPECT_EQ(OneClickSigninSyncStarter::UNDO_SYNC, mode_); | 321 EXPECT_EQ(OneClickSigninSyncStarter::UNDO_SYNC, mode_); |
| 323 } | 322 } |
| OLD | NEW |