OLD | NEW |
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/wm/window_state.h" | 5 #include "ash/wm/window_state.h" |
6 | 6 |
7 #include "ash/screen_util.h" | 7 #include "ash/screen_util.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "ash/wm/window_state.h" | 10 #include "ash/wm/window_state.h" |
11 #include "ash/wm/wm_event.h" | 11 #include "ash/wm/wm_event.h" |
12 #include "ui/aura/client/aura_constants.h" | 12 #include "ui/aura/client/aura_constants.h" |
13 #include "ui/aura/test/test_window_delegate.h" | 13 #include "ui/aura/test/test_window_delegate.h" |
14 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
15 | 15 |
16 namespace ash { | 16 namespace ash { |
17 namespace wm { | 17 namespace wm { |
18 namespace { | 18 namespace { |
19 | 19 |
20 class AlwaysMaximizeTestState : public WindowState::State { | 20 class AlwaysMaximizeTestState : public WindowState::State { |
21 public: | 21 public: |
22 explicit AlwaysMaximizeTestState(WindowStateType initial_state_type) | 22 explicit AlwaysMaximizeTestState(WindowStateType initial_state_type) |
23 : state_type_(initial_state_type) {} | 23 : state_type_(initial_state_type) {} |
24 virtual ~AlwaysMaximizeTestState() {} | 24 virtual ~AlwaysMaximizeTestState() {} |
25 | 25 |
26 // WindowState::State overrides: | 26 // WindowState::State overrides: |
27 virtual void OnWMEvent(WindowState* window_state, | 27 virtual void OnWMEvent(WindowState* window_state, |
28 const WMEvent* event) OVERRIDE { | 28 const WMEvent* event) override { |
29 // We don't do anything here. | 29 // We don't do anything here. |
30 } | 30 } |
31 virtual WindowStateType GetType() const OVERRIDE { | 31 virtual WindowStateType GetType() const override { |
32 return state_type_; | 32 return state_type_; |
33 } | 33 } |
34 virtual void AttachState( | 34 virtual void AttachState( |
35 WindowState* window_state, | 35 WindowState* window_state, |
36 WindowState::State* previous_state) OVERRIDE { | 36 WindowState::State* previous_state) override { |
37 // We always maximize. | 37 // We always maximize. |
38 if (state_type_ != WINDOW_STATE_TYPE_MAXIMIZED) { | 38 if (state_type_ != WINDOW_STATE_TYPE_MAXIMIZED) { |
39 window_state->Maximize(); | 39 window_state->Maximize(); |
40 state_type_ = WINDOW_STATE_TYPE_MAXIMIZED; | 40 state_type_ = WINDOW_STATE_TYPE_MAXIMIZED; |
41 } | 41 } |
42 } | 42 } |
43 virtual void DetachState(WindowState* window_state) OVERRIDE {} | 43 virtual void DetachState(WindowState* window_state) override {} |
44 | 44 |
45 private: | 45 private: |
46 WindowStateType state_type_; | 46 WindowStateType state_type_; |
47 | 47 |
48 DISALLOW_COPY_AND_ASSIGN(AlwaysMaximizeTestState); | 48 DISALLOW_COPY_AND_ASSIGN(AlwaysMaximizeTestState); |
49 }; | 49 }; |
50 | 50 |
51 } // namespace | 51 } // namespace |
52 | 52 |
53 typedef test::AshTestBase WindowStateTest; | 53 typedef test::AshTestBase WindowStateTest; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 EXPECT_FALSE(window_state->IsMaximized()); | 336 EXPECT_FALSE(window_state->IsMaximized()); |
337 EXPECT_NE(work_area.ToString(), window->bounds().ToString()); | 337 EXPECT_NE(work_area.ToString(), window->bounds().ToString()); |
338 EXPECT_TRUE(work_area.Contains(window->bounds())); | 338 EXPECT_TRUE(work_area.Contains(window->bounds())); |
339 } | 339 } |
340 | 340 |
341 // TODO(skuhne): Add more unit test to verify the correctness for the restore | 341 // TODO(skuhne): Add more unit test to verify the correctness for the restore |
342 // operation. | 342 // operation. |
343 | 343 |
344 } // namespace wm | 344 } // namespace wm |
345 } // namespace ash | 345 } // namespace ash |
OLD | NEW |