| OLD | NEW |
| 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 #ifndef ASH_TEST_ASH_TEST_BASE_H_ | 5 #ifndef ASH_TEST_ASH_TEST_BASE_H_ |
| 6 #define ASH_TEST_ASH_TEST_BASE_H_ | 6 #define ASH_TEST_ASH_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "third_party/skia/include/core/SkColor.h" |
| 15 #include "ui/aura/client/window_types.h" |
| 14 #include "ui/views/test/test_views_delegate.h" | 16 #include "ui/views/test/test_views_delegate.h" |
| 15 | 17 |
| 18 namespace aura { |
| 19 class Window; |
| 20 class WindowDelegate; |
| 21 } |
| 22 |
| 16 namespace ash { | 23 namespace ash { |
| 17 namespace internal { | 24 namespace internal { |
| 18 class DisplayManager; | 25 class DisplayManager; |
| 19 } // internal | 26 } // internal |
| 20 | 27 |
| 21 namespace test { | 28 namespace test { |
| 22 | 29 |
| 23 class TestShellDelegate; | 30 class TestShellDelegate; |
| 24 | 31 |
| 25 class AshTestViewsDelegate : public views::TestViewsDelegate { | 32 class AshTestViewsDelegate : public views::TestViewsDelegate { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 42 virtual void TearDown() OVERRIDE; | 49 virtual void TearDown() OVERRIDE; |
| 43 | 50 |
| 44 // Change the primary display's configuration to use |bounds| | 51 // Change the primary display's configuration to use |bounds| |
| 45 // and |scale|. | 52 // and |scale|. |
| 46 void ChangeDisplayConfig(float scale, const gfx::Rect& bounds); | 53 void ChangeDisplayConfig(float scale, const gfx::Rect& bounds); |
| 47 | 54 |
| 48 // Update the display configuration as given in |display_specs|. | 55 // Update the display configuration as given in |display_specs|. |
| 49 // See ash::test::DisplayManagerTestApi::UpdateDisplay for more details. | 56 // See ash::test::DisplayManagerTestApi::UpdateDisplay for more details. |
| 50 void UpdateDisplay(const std::string& display_specs); | 57 void UpdateDisplay(const std::string& display_specs); |
| 51 | 58 |
| 59 // Versions of the functions in aura::test:: that go through our shell |
| 60 // StackingController instead of taking a parent. |
| 61 aura::Window* CreateTestWindowInShellWithId(int id); |
| 62 aura::Window* CreateTestWindowInShellWithBounds(const gfx::Rect& bounds); |
| 63 aura::Window* CreateTestWindowInShell(SkColor color, |
| 64 int id, |
| 65 const gfx::Rect& bounds); |
| 66 aura::Window* CreateTestWindowInShellWithDelegate( |
| 67 aura::WindowDelegate* delegate, |
| 68 int id, |
| 69 const gfx::Rect& bounds); |
| 70 aura::Window* CreateTestWindowInShellWithDelegateAndType( |
| 71 aura::WindowDelegate* delegate, |
| 72 aura::client::WindowType type, |
| 73 int id, |
| 74 const gfx::Rect& bounds); |
| 75 |
| 76 // Attach this to the current shell's root window. |
| 77 void SetDefaultParentByPrimaryRootWindow(aura::Window* window); |
| 78 |
| 52 protected: | 79 protected: |
| 53 void RunAllPendingInMessageLoop(); | 80 void RunAllPendingInMessageLoop(); |
| 54 | 81 |
| 55 // Utility methods to emulate user logged in or not, session started or not | 82 // Utility methods to emulate user logged in or not, session started or not |
| 56 // and user able to lock screen or not cases. | 83 // and user able to lock screen or not cases. |
| 57 void SetSessionStarted(bool session_started); | 84 void SetSessionStarted(bool session_started); |
| 58 void SetUserLoggedIn(bool user_logged_in); | 85 void SetUserLoggedIn(bool user_logged_in); |
| 59 void SetCanLockScreen(bool can_lock_screen); | 86 void SetCanLockScreen(bool can_lock_screen); |
| 60 | 87 |
| 61 private: | 88 private: |
| 62 MessageLoopForUI message_loop_; | 89 MessageLoopForUI message_loop_; |
| 63 | 90 |
| 64 TestShellDelegate* test_shell_delegate_; | 91 TestShellDelegate* test_shell_delegate_; |
| 65 | 92 |
| 66 DISALLOW_COPY_AND_ASSIGN(AshTestBase); | 93 DISALLOW_COPY_AND_ASSIGN(AshTestBase); |
| 67 }; | 94 }; |
| 68 | 95 |
| 69 } // namespace test | 96 } // namespace test |
| 70 } // namespace ash | 97 } // namespace ash |
| 71 | 98 |
| 72 #endif // ASH_TEST_ASH_TEST_BASE_H_ | 99 #endif // ASH_TEST_ASH_TEST_BASE_H_ |
| OLD | NEW |