| 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 "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 13 #include "content/public/test/test_browser_thread_bundle.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "third_party/skia/include/core/SkColor.h" | 15 #include "third_party/skia/include/core/SkColor.h" |
| 15 #include "ui/aura/client/window_types.h" | 16 #include "ui/aura/client/window_types.h" |
| 16 #include "ui/views/test/test_views_delegate.h" | 17 #include "ui/views/test/test_views_delegate.h" |
| 17 | 18 |
| 18 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 19 #include "ui/base/win/scoped_ole_initializer.h" | 20 #include "ui/base/win/scoped_ole_initializer.h" |
| 20 #endif | 21 #endif |
| 21 | 22 |
| 22 namespace aura { | 23 namespace aura { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 47 virtual content::WebContents* CreateWebContents( | 48 virtual content::WebContents* CreateWebContents( |
| 48 content::BrowserContext* browser_context, | 49 content::BrowserContext* browser_context, |
| 49 content::SiteInstance* site_instance) OVERRIDE; | 50 content::SiteInstance* site_instance) OVERRIDE; |
| 50 }; | 51 }; |
| 51 | 52 |
| 52 class AshTestBase : public testing::Test { | 53 class AshTestBase : public testing::Test { |
| 53 public: | 54 public: |
| 54 AshTestBase(); | 55 AshTestBase(); |
| 55 virtual ~AshTestBase(); | 56 virtual ~AshTestBase(); |
| 56 | 57 |
| 57 base::MessageLoopForUI* message_loop() { return &message_loop_; } | |
| 58 | |
| 59 // testing::Test: | 58 // testing::Test: |
| 60 virtual void SetUp() OVERRIDE; | 59 virtual void SetUp() OVERRIDE; |
| 61 virtual void TearDown() OVERRIDE; | 60 virtual void TearDown() OVERRIDE; |
| 62 | 61 |
| 63 // Update the display configuration as given in |display_specs|. | 62 // Update the display configuration as given in |display_specs|. |
| 64 // See ash::test::DisplayManagerTestApi::UpdateDisplay for more details. | 63 // See ash::test::DisplayManagerTestApi::UpdateDisplay for more details. |
| 65 void UpdateDisplay(const std::string& display_specs); | 64 void UpdateDisplay(const std::string& display_specs); |
| 66 | 65 |
| 67 // Returns a RootWindow. Usually this is the active RootWindow, but that | 66 // Returns a RootWindow. Usually this is the active RootWindow, but that |
| 68 // method can return NULL sometimes, and in those cases, we fall back on the | 67 // method can return NULL sometimes, and in those cases, we fall back on the |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 106 |
| 108 // Utility methods to emulate user logged in or not, session started or not | 107 // Utility methods to emulate user logged in or not, session started or not |
| 109 // and user able to lock screen or not cases. | 108 // and user able to lock screen or not cases. |
| 110 void SetSessionStarted(bool session_started); | 109 void SetSessionStarted(bool session_started); |
| 111 void SetUserLoggedIn(bool user_logged_in); | 110 void SetUserLoggedIn(bool user_logged_in); |
| 112 void SetCanLockScreen(bool can_lock_screen); | 111 void SetCanLockScreen(bool can_lock_screen); |
| 113 | 112 |
| 114 private: | 113 private: |
| 115 bool setup_called_; | 114 bool setup_called_; |
| 116 bool teardown_called_; | 115 bool teardown_called_; |
| 117 base::MessageLoopForUI message_loop_; | 116 content::TestBrowserThreadBundle thread_bundle_; |
| 118 scoped_ptr<AshTestHelper> ash_test_helper_; | 117 scoped_ptr<AshTestHelper> ash_test_helper_; |
| 119 scoped_ptr<aura::test::EventGenerator> event_generator_; | 118 scoped_ptr<aura::test::EventGenerator> event_generator_; |
| 120 #if defined(OS_WIN) | 119 #if defined(OS_WIN) |
| 121 // Note that the order is important here as ipc_thread_ should be destroyed | 120 // Note that the order is important here as ipc_thread_ should be destroyed |
| 122 // after metro_viewer_host_->channel_. | 121 // after metro_viewer_host_->channel_. |
| 123 scoped_ptr<base::Thread> ipc_thread_; | 122 scoped_ptr<base::Thread> ipc_thread_; |
| 124 scoped_ptr<TestMetroViewerProcessHost> metro_viewer_host_; | 123 scoped_ptr<TestMetroViewerProcessHost> metro_viewer_host_; |
| 125 ui::ScopedOleInitializer ole_initializer_; | 124 ui::ScopedOleInitializer ole_initializer_; |
| 126 #endif | 125 #endif |
| 127 | 126 |
| 128 DISALLOW_COPY_AND_ASSIGN(AshTestBase); | 127 DISALLOW_COPY_AND_ASSIGN(AshTestBase); |
| 129 }; | 128 }; |
| 130 | 129 |
| 131 } // namespace test | 130 } // namespace test |
| 132 } // namespace ash | 131 } // namespace ash |
| 133 | 132 |
| 134 #endif // ASH_TEST_ASH_TEST_BASE_H_ | 133 #endif // ASH_TEST_ASH_TEST_BASE_H_ |
| OLD | NEW |