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 #ifndef ATHENA_TEST_ATHENA_TEST_BASE_H_ | 5 #ifndef ATHENA_TEST_ATHENA_TEST_BASE_H_ |
6 #define ATHENA_TEST_ATHENA_TEST_BASE_H_ | 6 #define ATHENA_TEST_ATHENA_TEST_BASE_H_ |
7 | 7 |
8 #include "athena/test/athena_test_helper.h" | 8 #include "athena/test/athena_test_helper.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace aura { | 13 namespace aura { |
14 class Window; | 14 class Window; |
| 15 class WindowDelegate; |
15 } | 16 } |
16 | 17 |
17 namespace athena { | 18 namespace athena { |
18 namespace test { | 19 namespace test { |
19 | 20 |
20 // A base class for athena unit tests. | 21 // A base class for athena unit tests. |
21 class AthenaTestBase : public testing::Test { | 22 class AthenaTestBase : public testing::Test { |
22 public: | 23 public: |
23 AthenaTestBase(); | 24 AthenaTestBase(); |
24 virtual ~AthenaTestBase(); | 25 virtual ~AthenaTestBase(); |
25 | 26 |
26 // testing::Test: | 27 // testing::Test: |
27 virtual void SetUp() OVERRIDE; | 28 virtual void SetUp() OVERRIDE; |
28 virtual void TearDown() OVERRIDE; | 29 virtual void TearDown() OVERRIDE; |
29 | 30 |
30 protected: | 31 protected: |
31 void RunAllPendingInMessageLoop(); | 32 void RunAllPendingInMessageLoop(); |
32 | 33 |
| 34 scoped_ptr<aura::Window> CreateTestWindow(aura::WindowDelegate* delegate, |
| 35 const gfx::Rect& bounds); |
| 36 |
33 aura::Window* root_window() { return helper_->root_window(); } | 37 aura::Window* root_window() { return helper_->root_window(); } |
34 aura::WindowTreeHost* host() { return helper_->host(); } | 38 aura::WindowTreeHost* host() { return helper_->host(); } |
35 | 39 |
36 private: | 40 private: |
37 bool setup_called_; | 41 bool setup_called_; |
38 bool teardown_called_; | 42 bool teardown_called_; |
39 | 43 |
40 base::MessageLoopForUI message_loop_; | 44 base::MessageLoopForUI message_loop_; |
41 scoped_ptr<AthenaTestHelper> helper_; | 45 scoped_ptr<AthenaTestHelper> helper_; |
42 | 46 |
43 DISALLOW_COPY_AND_ASSIGN(AthenaTestBase); | 47 DISALLOW_COPY_AND_ASSIGN(AthenaTestBase); |
44 }; | 48 }; |
45 | 49 |
46 } // namespace test | 50 } // namespace test |
47 } // namespace athena | 51 } // namespace athena |
48 | 52 |
49 #endif // ATHENA_TEST_ATHENA_TEST_BASE_H_ | 53 #endif // ATHENA_TEST_ATHENA_TEST_BASE_H_ |
OLD | NEW |