MD Downloads: prevent search text from overlapping with the cancel search (X)
[chromium-blink-merge.git] / ui / aura / test / aura_test_base.h
blobaf89fc8f3efd544a10d7670cb311212a5b0aa563
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.
5 #ifndef UI_AURA_TEST_AURA_TEST_BASE_H_
6 #define UI_AURA_TEST_AURA_TEST_BASE_H_
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"
14 namespace aura {
15 class Window;
16 class WindowDelegate;
17 namespace test {
19 // A base class for aura unit tests.
20 // TODO(beng): Instances of this test will create and own a RootWindow.
21 class AuraTestBase : public testing::Test {
22 public:
23 AuraTestBase();
24 ~AuraTestBase() override;
26 // testing::Test:
27 void SetUp() override;
28 void TearDown() override;
30 // Creates a normal window parented to |parent|.
31 aura::Window* CreateNormalWindow(int id, Window* parent,
32 aura::WindowDelegate* delegate);
34 protected:
35 void RunAllPendingInMessageLoop();
37 void ParentWindow(Window* window);
39 // A convenience function for dispatching an event to |dispatcher()|.
40 // Returns whether |event| was handled.
41 bool DispatchEventUsingWindowDispatcher(ui::Event* event);
43 Window* root_window() { return helper_->root_window(); }
44 WindowTreeHost* host() { return helper_->host(); }
45 ui::EventProcessor* event_processor() { return helper_->event_processor(); }
46 TestScreen* test_screen() { return helper_->test_screen(); }
48 private:
49 bool setup_called_;
50 bool teardown_called_;
51 base::MessageLoopForUI message_loop_;
52 scoped_ptr<AuraTestHelper> helper_;
54 DISALLOW_COPY_AND_ASSIGN(AuraTestBase);
57 } // namespace test
58 } // namespace aura
60 #endif // UI_AURA_TEST_AURA_TEST_BASE_H_