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 "ash/root_window_controller.h" | 5 #include "ash/root_window_controller.h" |
6 #include "ash/shelf/shelf_widget.h" | 6 #include "ash/shelf/shelf_widget.h" |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "ash/test/test_session_state_delegate.h" | 10 #include "ash/test/test_session_state_delegate.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 namespace test { | 33 namespace test { |
34 | 34 |
35 // A test class for preparing the chrome::MultiUserWindowManager. It creates | 35 // A test class for preparing the chrome::MultiUserWindowManager. It creates |
36 // various windows and instantiates the chrome::MultiUserWindowManager. | 36 // various windows and instantiates the chrome::MultiUserWindowManager. |
37 class MultiUserWindowManagerChromeOSTest : public AshTestBase { | 37 class MultiUserWindowManagerChromeOSTest : public AshTestBase { |
38 public: | 38 public: |
39 MultiUserWindowManagerChromeOSTest() | 39 MultiUserWindowManagerChromeOSTest() |
40 : multi_user_window_manager_(NULL), | 40 : multi_user_window_manager_(NULL), |
41 session_state_delegate_(NULL) {} | 41 session_state_delegate_(NULL) {} |
42 | 42 |
43 virtual void SetUp() override; | 43 void SetUp() override; |
44 virtual void TearDown() override; | 44 void TearDown() override; |
45 | 45 |
46 protected: | 46 protected: |
47 // Set up the test environment for this many windows. | 47 // Set up the test environment for this many windows. |
48 void SetUpForThisManyWindows(int windows); | 48 void SetUpForThisManyWindows(int windows); |
49 | 49 |
50 // Switch the user and wait until the animation is finished. | 50 // Switch the user and wait until the animation is finished. |
51 void SwitchUserAndWaitForAnimation(const std::string& user_id) { | 51 void SwitchUserAndWaitForAnimation(const std::string& user_id) { |
52 multi_user_window_manager_->ActiveUserChanged(user_id); | 52 multi_user_window_manager_->ActiveUserChanged(user_id); |
53 base::TimeTicks now = base::TimeTicks::Now(); | 53 base::TimeTicks now = base::TimeTicks::Now(); |
54 while (multi_user_window_manager_->IsAnimationRunningForTest()) { | 54 while (multi_user_window_manager_->IsAnimationRunningForTest()) { |
(...skipping 981 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1036 | 1036 |
1037 // Check that teleporting back will also change the desktop. | 1037 // Check that teleporting back will also change the desktop. |
1038 multi_user_window_manager()->ShowWindowForUser(window(2), "c"); | 1038 multi_user_window_manager()->ShowWindowForUser(window(2), "c"); |
1039 EXPECT_EQ("c", GetAndValidateCurrentUserFromSessionStateObserver()); | 1039 EXPECT_EQ("c", GetAndValidateCurrentUserFromSessionStateObserver()); |
1040 EXPECT_EQ("H[a,b], H[b], S[c]", GetStatus()); | 1040 EXPECT_EQ("H[a,b], H[b], S[c]", GetStatus()); |
1041 } | 1041 } |
1042 | 1042 |
1043 class TestWindowObserver : public aura::WindowObserver { | 1043 class TestWindowObserver : public aura::WindowObserver { |
1044 public: | 1044 public: |
1045 TestWindowObserver(): resize_calls_(0) {} | 1045 TestWindowObserver(): resize_calls_(0) {} |
1046 virtual ~TestWindowObserver() {}; | 1046 ~TestWindowObserver() override{}; |
1047 | 1047 |
1048 virtual void OnWindowBoundsChanged(aura::Window* window, | 1048 void OnWindowBoundsChanged(aura::Window* window, |
1049 const gfx::Rect& old_bounds, | 1049 const gfx::Rect& old_bounds, |
1050 const gfx::Rect& new_bounds) override { | 1050 const gfx::Rect& new_bounds) override { |
1051 resize_calls_++; | 1051 resize_calls_++; |
1052 } | 1052 } |
1053 | 1053 |
1054 int resize_calls() { return resize_calls_; } | 1054 int resize_calls() { return resize_calls_; } |
1055 | 1055 |
1056 private: | 1056 private: |
1057 int resize_calls_; | 1057 int resize_calls_; |
1058 | 1058 |
1059 DISALLOW_COPY_AND_ASSIGN(TestWindowObserver); | 1059 DISALLOW_COPY_AND_ASSIGN(TestWindowObserver); |
1060 }; | 1060 }; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1116 AdvanceUserTransitionAnimation(); | 1116 AdvanceUserTransitionAnimation(); |
1117 EXPECT_FALSE(shelf->IsShelfHiddenBehindBlackBar()); | 1117 EXPECT_FALSE(shelf->IsShelfHiddenBehindBlackBar()); |
1118 window(0)->RemoveObserver(&window_observer); | 1118 window(0)->RemoveObserver(&window_observer); |
1119 window(1)->RemoveObserver(&window_observer); | 1119 window(1)->RemoveObserver(&window_observer); |
1120 // No resize should have been done to the window. | 1120 // No resize should have been done to the window. |
1121 EXPECT_EQ(0, window_observer.resize_calls()); | 1121 EXPECT_EQ(0, window_observer.resize_calls()); |
1122 } | 1122 } |
1123 | 1123 |
1124 } // namespace test | 1124 } // namespace test |
1125 } // namespace ash | 1125 } // namespace ash |
OLD | NEW |