| 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 "ui/views/test/test_views_delegate.h" | 14 #include "ui/views/test/test_views_delegate.h" |
| 15 | 15 |
| 16 namespace ash { | 16 namespace ash { |
| 17 namespace internal { | 17 namespace internal { |
| 18 class MultiDisplayManager; | 18 class DisplayManager; |
| 19 } // internal | 19 } // internal |
| 20 | 20 |
| 21 namespace test { | 21 namespace test { |
| 22 | 22 |
| 23 class AshTestViewsDelegate : public views::TestViewsDelegate { | 23 class AshTestViewsDelegate : public views::TestViewsDelegate { |
| 24 public: | 24 public: |
| 25 // Overriden from TestViewsDelegate. | 25 // Overriden from TestViewsDelegate. |
| 26 virtual content::WebContents* CreateWebContents( | 26 virtual content::WebContents* CreateWebContents( |
| 27 content::BrowserContext* browser_context, | 27 content::BrowserContext* browser_context, |
| 28 content::SiteInstance* site_instance) OVERRIDE; | 28 content::SiteInstance* site_instance) OVERRIDE; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 class AshTestBase : public testing::Test { | 31 class AshTestBase : public testing::Test { |
| 32 public: | 32 public: |
| 33 AshTestBase(); | 33 AshTestBase(); |
| 34 virtual ~AshTestBase(); | 34 virtual ~AshTestBase(); |
| 35 | 35 |
| 36 MessageLoopForUI* message_loop() { return &message_loop_; } | 36 MessageLoopForUI* message_loop() { return &message_loop_; } |
| 37 | 37 |
| 38 // testing::Test: | 38 // testing::Test: |
| 39 virtual void SetUp() OVERRIDE; | 39 virtual void SetUp() OVERRIDE; |
| 40 virtual void TearDown() OVERRIDE; | 40 virtual void TearDown() OVERRIDE; |
| 41 | 41 |
| 42 // Change the primary display's configuration to use |bounds| | 42 // Change the primary display's configuration to use |bounds| |
| 43 // and |scale|. | 43 // and |scale|. |
| 44 void ChangeDisplayConfig(float scale, const gfx::Rect& bounds); | 44 void ChangeDisplayConfig(float scale, const gfx::Rect& bounds); |
| 45 | 45 |
| 46 // Update the display configuration as given in |display_specs|. | 46 // Update the display configuration as given in |display_specs|. |
| 47 // See ash::test::MultiDisplayManagerTestApi::UpdateDisplay for more details. | 47 // See ash::test::DisplayManagerTestApi::UpdateDisplay for more details. |
| 48 void UpdateDisplay(const std::string& display_specs); | 48 void UpdateDisplay(const std::string& display_specs); |
| 49 | 49 |
| 50 protected: | 50 protected: |
| 51 void RunAllPendingInMessageLoop(); | 51 void RunAllPendingInMessageLoop(); |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 MessageLoopForUI message_loop_; | 54 MessageLoopForUI message_loop_; |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(AshTestBase); | 56 DISALLOW_COPY_AND_ASSIGN(AshTestBase); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace test | 59 } // namespace test |
| 60 } // namespace ash | 60 } // namespace ash |
| 61 | 61 |
| 62 #endif // ASH_TEST_ASH_TEST_BASE_H_ | 62 #endif // ASH_TEST_ASH_TEST_BASE_H_ |
| OLD | NEW |