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

Side by Side Diff: chrome/browser/chromeos/ui/idle_logout_dialog_view_browsertest.cc

Issue 18179004: Dismiss action in tab modal dialogs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test for Mac Created 7 years, 4 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
OLDNEW
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/chromeos/ui/idle_logout_dialog_view.h" 5 #include "chrome/browser/chromeos/ui/idle_logout_dialog_view.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "chrome/browser/chromeos/kiosk_mode/mock_kiosk_mode_settings.h" 8 #include "chrome/browser/chromeos/kiosk_mode/mock_kiosk_mode_settings.h"
9 #include "chrome/test/base/in_process_browser_test.h" 9 #include "chrome/test/base/in_process_browser_test.h"
10 #include "chrome/test/base/ui_test_utils.h" 10 #include "chrome/test/base/ui_test_utils.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/views/widget/widget.h"
12 13
13 namespace chromeos { 14 namespace chromeos {
14 15
15 class MockIdleLogoutSettingsProvider : public IdleLogoutSettingsProvider { 16 class MockIdleLogoutSettingsProvider : public IdleLogoutSettingsProvider {
16 public: 17 public:
17 explicit MockIdleLogoutSettingsProvider(KioskModeSettings* mock_settings) 18 explicit MockIdleLogoutSettingsProvider(KioskModeSettings* mock_settings)
18 : mock_settings_(mock_settings) {} 19 : mock_settings_(mock_settings) {}
19 20
20 virtual base::TimeDelta GetCountdownUpdateInterval() OVERRIDE { 21 virtual base::TimeDelta GetCountdownUpdateInterval() OVERRIDE {
21 return base::TimeDelta::FromMilliseconds(0); 22 return base::TimeDelta::FromMilliseconds(0);
22 } 23 }
23 24
24 virtual KioskModeSettings* GetKioskModeSettings() OVERRIDE { 25 virtual KioskModeSettings* GetKioskModeSettings() OVERRIDE {
25 return mock_settings_; 26 return mock_settings_;
26 } 27 }
27 28
28 virtual void LogoutCurrentUser(IdleLogoutDialogView* dialog) OVERRIDE { 29 virtual void LogoutCurrentUser(IdleLogoutDialogView* dialog) OVERRIDE {
29 dialog->Close(); 30 dialog->GetWidget()->Close();
30 } 31 }
31 32
32 private: 33 private:
33 KioskModeSettings* mock_settings_; 34 KioskModeSettings* mock_settings_;
34 35
35 DISALLOW_COPY_AND_ASSIGN(MockIdleLogoutSettingsProvider); 36 DISALLOW_COPY_AND_ASSIGN(MockIdleLogoutSettingsProvider);
36 }; 37 };
37 38
38 class IdleLogoutDialogViewTest : public InProcessBrowserTest { 39 class IdleLogoutDialogViewTest : public InProcessBrowserTest {
39 public: 40 public:
(...skipping 30 matching lines...) Expand all
70 EXPECT_NO_FATAL_FAILURE(ExpectOpenDialog()); 71 EXPECT_NO_FATAL_FAILURE(ExpectOpenDialog());
71 72
72 IdleLogoutDialogView::CloseDialog(); 73 IdleLogoutDialogView::CloseDialog();
73 ExpectClosedDialog(); 74 ExpectClosedDialog();
74 } 75 }
75 76
76 IN_PROC_BROWSER_TEST_F(IdleLogoutDialogViewTest, ShowDialogAndCloseView) { 77 IN_PROC_BROWSER_TEST_F(IdleLogoutDialogViewTest, ShowDialogAndCloseView) {
77 IdleLogoutDialogView::ShowDialog(); 78 IdleLogoutDialogView::ShowDialog();
78 EXPECT_NO_FATAL_FAILURE(ExpectOpenDialog()); 79 EXPECT_NO_FATAL_FAILURE(ExpectOpenDialog());
79 80
80 IdleLogoutDialogView::current_instance()->Close(); 81 IdleLogoutDialogView::CloseDialog();
81 content::RunAllPendingInMessageLoop(); 82 content::RunAllPendingInMessageLoop();
82 ExpectClosedDialog(); 83 ExpectClosedDialog();
83 } 84 }
84 85
85 IN_PROC_BROWSER_TEST_F(IdleLogoutDialogViewTest, ShowDialogAndCloseViewClose) { 86 IN_PROC_BROWSER_TEST_F(IdleLogoutDialogViewTest, ShowDialogAndCloseViewClose) {
86 IdleLogoutDialogView::ShowDialog(); 87 IdleLogoutDialogView::ShowDialog();
87 EXPECT_NO_FATAL_FAILURE(ExpectOpenDialog()); 88 EXPECT_NO_FATAL_FAILURE(ExpectOpenDialog());
88 89
89 IdleLogoutDialogView::current_instance()->Close(); 90 IdleLogoutDialogView::CloseDialog();
90 content::RunAllPendingInMessageLoop(); 91 content::RunAllPendingInMessageLoop();
91 IdleLogoutDialogView::CloseDialog(); 92 IdleLogoutDialogView::CloseDialog();
92 93
93 ExpectClosedDialog(); 94 ExpectClosedDialog();
94 } 95 }
95 96
96 IN_PROC_BROWSER_TEST_F(IdleLogoutDialogViewTest, 97 IN_PROC_BROWSER_TEST_F(IdleLogoutDialogViewTest,
97 OutOfOrderMultipleShowDialogAndClose) { 98 OutOfOrderMultipleShowDialogAndClose) {
98 IdleLogoutDialogView::CloseDialog(); 99 IdleLogoutDialogView::CloseDialog();
99 ExpectClosedDialog(); 100 ExpectClosedDialog();
(...skipping 12 matching lines...) Expand all
112 IN_PROC_BROWSER_TEST_F(IdleLogoutDialogViewTest, 113 IN_PROC_BROWSER_TEST_F(IdleLogoutDialogViewTest,
113 ShowDialogAndFinishCountdown) { 114 ShowDialogAndFinishCountdown) {
114 IdleLogoutDialogView::ShowDialog(); 115 IdleLogoutDialogView::ShowDialog();
115 EXPECT_NO_FATAL_FAILURE(ExpectOpenDialog()); 116 EXPECT_NO_FATAL_FAILURE(ExpectOpenDialog());
116 117
117 content::RunAllPendingInMessageLoop(); 118 content::RunAllPendingInMessageLoop();
118 ExpectClosedDialog(); 119 ExpectClosedDialog();
119 } 120 }
120 121
121 } // namespace chromeos 122 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/ui/idle_logout_dialog_view.cc ('k') | chrome/browser/download/download_danger_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698