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

Side by Side Diff: chrome/browser/ui/ash/multi_user/user_switch_util_unittest.cc

Issue 2144083002: mash: Move user_switch_util to chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ash/common/system/chromeos/screen_security/screen_tray_item.h" 5 #include "ash/common/system/chromeos/screen_security/screen_tray_item.h"
6 #include "ash/shell.h"
7 #include "ash/system/chromeos/multi_user/user_switch_util.h"
8 #include "ash/system/tray/system_tray.h" 6 #include "ash/system/tray/system_tray.h"
9 #include "ash/test/ash_test_base.h" 7 #include "ash/test/ash_test_base.h"
8 #include "chrome/browser/ui/ash/multi_user/user_switch_util.h"
10 9
11 namespace ash { 10 namespace ash {
12 11
13 class TrySwitchingUserTest : public ash::test::AshTestBase { 12 class TrySwitchingUserTest : public ash::test::AshTestBase {
14 public: 13 public:
15 // The action type to perform / check for upon user switching. 14 // The action type to perform / check for upon user switching.
16 enum ActionType { 15 enum ActionType {
17 NO_DIALOG, // No dialog should be shown. 16 NO_DIALOG, // No dialog should be shown.
18 ACCEPT_DIALOG, // A dialog should be shown and we should accept it. 17 ACCEPT_DIALOG, // A dialog should be shown and we should accept it.
19 DECLINE_DIALOG, // A dialog should be shown and we do not accept it. 18 DECLINE_DIALOG, // A dialog should be shown and we do not accept it.
20 }; 19 };
21 TrySwitchingUserTest() 20 TrySwitchingUserTest()
22 : capture_item_(NULL), 21 : capture_item_(NULL),
23 share_item_(NULL), 22 share_item_(NULL),
24 stop_capture_callback_hit_count_(0), 23 stop_capture_callback_hit_count_(0),
25 stop_share_callback_hit_count_(0), 24 stop_share_callback_hit_count_(0),
26 switch_callback_hit_count_(0) {} 25 switch_callback_hit_count_(0) {}
27 ~TrySwitchingUserTest() override {} 26 ~TrySwitchingUserTest() override {}
28 27
29 void SetUp() override { 28 void SetUp() override {
30 test::AshTestBase::SetUp(); 29 test::AshTestBase::SetUp();
31 TrayItemView::DisableAnimationsForTest(); 30 TrayItemView::DisableAnimationsForTest();
32 SystemTray* system_tray = Shell::GetInstance()->GetPrimarySystemTray(); 31 SystemTray* system_tray = GetPrimarySystemTray();
33 share_item_ = system_tray->GetScreenShareItem(); 32 share_item_ = system_tray->GetScreenShareItem();
34 capture_item_ = system_tray->GetScreenCaptureItem(); 33 capture_item_ = system_tray->GetScreenCaptureItem();
35 EXPECT_TRUE(share_item_); 34 EXPECT_TRUE(share_item_);
36 EXPECT_TRUE(capture_item_); 35 EXPECT_TRUE(capture_item_);
37 } 36 }
38 37
39 // Accessing the capture session functionality. 38 // Accessing the capture session functionality.
40 // Simulates a screen capture session start. 39 // Simulates a screen capture session start.
41 void StartCaptureSession() { 40 void StartCaptureSession() {
42 capture_item_->Start(base::Bind(&TrySwitchingUserTest::StopCaptureCallback, 41 capture_item_->Start(base::Bind(&TrySwitchingUserTest::StopCaptureCallback,
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 EXPECT_EQ(1, stop_share_callback_hit_count()); 205 EXPECT_EQ(1, stop_share_callback_hit_count());
207 // Another stop should have no effect. 206 // Another stop should have no effect.
208 StopShareSession(); 207 StopShareSession();
209 StopCaptureSession(); 208 StopCaptureSession();
210 EXPECT_EQ(1, switch_callback_hit_count()); 209 EXPECT_EQ(1, switch_callback_hit_count());
211 EXPECT_EQ(1, stop_capture_callback_hit_count()); 210 EXPECT_EQ(1, stop_capture_callback_hit_count());
212 EXPECT_EQ(1, stop_share_callback_hit_count()); 211 EXPECT_EQ(1, stop_share_callback_hit_count());
213 } 212 }
214 213
215 } // namespace ash 214 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698