| 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 ~AlwaysMaximizeTestState() override {} |
| 25 | 25 |
| 26 // WindowState::State overrides: | 26 // WindowState::State overrides: |
| 27 virtual void OnWMEvent(WindowState* window_state, | 27 void OnWMEvent(WindowState* window_state, const WMEvent* event) override { |
| 28 const WMEvent* event) override { | |
| 29 // We don't do anything here. | 28 // We don't do anything here. |
| 30 } | 29 } |
| 31 virtual WindowStateType GetType() const override { | 30 WindowStateType GetType() const override { return state_type_; } |
| 32 return state_type_; | 31 void AttachState(WindowState* window_state, |
| 33 } | 32 WindowState::State* previous_state) override { |
| 34 virtual void AttachState( | |
| 35 WindowState* window_state, | |
| 36 WindowState::State* previous_state) override { | |
| 37 // We always maximize. | 33 // We always maximize. |
| 38 if (state_type_ != WINDOW_STATE_TYPE_MAXIMIZED) { | 34 if (state_type_ != WINDOW_STATE_TYPE_MAXIMIZED) { |
| 39 window_state->Maximize(); | 35 window_state->Maximize(); |
| 40 state_type_ = WINDOW_STATE_TYPE_MAXIMIZED; | 36 state_type_ = WINDOW_STATE_TYPE_MAXIMIZED; |
| 41 } | 37 } |
| 42 } | 38 } |
| 43 virtual void DetachState(WindowState* window_state) override {} | 39 void DetachState(WindowState* window_state) override {} |
| 44 | 40 |
| 45 private: | 41 private: |
| 46 WindowStateType state_type_; | 42 WindowStateType state_type_; |
| 47 | 43 |
| 48 DISALLOW_COPY_AND_ASSIGN(AlwaysMaximizeTestState); | 44 DISALLOW_COPY_AND_ASSIGN(AlwaysMaximizeTestState); |
| 49 }; | 45 }; |
| 50 | 46 |
| 51 } // namespace | 47 } // namespace |
| 52 | 48 |
| 53 typedef test::AshTestBase WindowStateTest; | 49 typedef test::AshTestBase WindowStateTest; |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 EXPECT_FALSE(window_state->IsMaximized()); | 332 EXPECT_FALSE(window_state->IsMaximized()); |
| 337 EXPECT_NE(work_area.ToString(), window->bounds().ToString()); | 333 EXPECT_NE(work_area.ToString(), window->bounds().ToString()); |
| 338 EXPECT_TRUE(work_area.Contains(window->bounds())); | 334 EXPECT_TRUE(work_area.Contains(window->bounds())); |
| 339 } | 335 } |
| 340 | 336 |
| 341 // TODO(skuhne): Add more unit test to verify the correctness for the restore | 337 // TODO(skuhne): Add more unit test to verify the correctness for the restore |
| 342 // operation. | 338 // operation. |
| 343 | 339 |
| 344 } // namespace wm | 340 } // namespace wm |
| 345 } // namespace ash | 341 } // namespace ash |
| OLD | NEW |