- add sources.
[platform/framework/web/crosswalk.git] / src / ui / aura / test / aura_test_base.h
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
3 // found in the LICENSE file.
4
5 #ifndef UI_AURA_TEST_AURA_TEST_BASE_H_
6 #define UI_AURA_TEST_AURA_TEST_BASE_H_
7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
10 #include "base/message_loop/message_loop.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "ui/aura/test/aura_test_helper.h"
13
14 namespace aura {
15 class RootWindow;
16 class Window;
17 class WindowDelegate;
18 namespace test {
19
20 // A base class for aura unit tests.
21 // TODO(beng): Instances of this test will create and own a RootWindow.
22 class AuraTestBase : public testing::Test {
23  public:
24   AuraTestBase();
25   virtual ~AuraTestBase();
26
27   // testing::Test:
28   virtual void SetUp() OVERRIDE;
29   virtual void TearDown() OVERRIDE;
30
31   // Creates a normal window parented to |parent|.
32   aura::Window* CreateNormalWindow(int id, Window* parent,
33                                    aura::WindowDelegate* delegate);
34
35   // Creates a transient window that is transient to |parent|.
36   aura::Window* CreateTransientChild(int id, aura::Window* parent);
37
38  protected:
39   void RunAllPendingInMessageLoop();
40
41   void ParentWindow(Window* window);
42
43   RootWindow* root_window() { return helper_->root_window(); }
44   TestScreen* test_screen() { return helper_->test_screen(); }
45
46  private:
47   bool setup_called_;
48   bool teardown_called_;
49   base::MessageLoopForUI message_loop_;
50   scoped_ptr<AuraTestHelper> helper_;
51
52   DISALLOW_COPY_AND_ASSIGN(AuraTestBase);
53 };
54
55 }  // namespace test
56 }  // namespace aura
57
58 #endif  // UI_AURA_TEST_AURA_TEST_BASE_H_