Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(380)

Side by Side Diff: ui/views/test/views_test_base.h

Issue 273073002: Changes code using Compositor to pass in ContextFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tooltip on chromeos Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ 5 #ifndef UI_VIEWS_TEST_VIEWS_TEST_BASE_H_
6 #define UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ 6 #define UI_VIEWS_TEST_VIEWS_TEST_BASE_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/views/test/test_views_delegate.h" 11 #include "ui/views/test/test_views_delegate.h"
12 12
13 #if defined(OS_WIN) 13 #if defined(OS_WIN)
14 #include "ui/base/win/scoped_ole_initializer.h" 14 #include "ui/base/win/scoped_ole_initializer.h"
15 #endif 15 #endif
16 16
17 namespace ui {
18 class ContextFactory;
19 }
20
17 namespace views { 21 namespace views {
18 22
19 class ViewsTestHelper; 23 class ViewsTestHelper;
20 24
21 // A base class for views unit test. It creates a message loop necessary 25 // A base class for views unit test. It creates a message loop necessary
22 // to drive UI events and takes care of OLE initialization for windows. 26 // to drive UI events and takes care of OLE initialization for windows.
23 class ViewsTestBase : public testing::Test { 27 class ViewsTestBase : public testing::Test {
24 public: 28 public:
25 ViewsTestBase(); 29 ViewsTestBase();
26 virtual ~ViewsTestBase(); 30 virtual ~ViewsTestBase();
27 31
28 // testing::Test: 32 // testing::Test:
29 virtual void SetUp() OVERRIDE; 33 virtual void SetUp() OVERRIDE;
30 virtual void TearDown() OVERRIDE; 34 virtual void TearDown() OVERRIDE;
31 35
32 void RunPendingMessages(); 36 void RunPendingMessages();
33 37
34 // Creates a widget of |type| with any platform specific data for use in 38 // Creates a widget of |type| with any platform specific data for use in
35 // cross-platform tests. 39 // cross-platform tests.
36 Widget::InitParams CreateParams(Widget::InitParams::Type type); 40 Widget::InitParams CreateParams(Widget::InitParams::Type type);
37 41
42 ui::ContextFactory* context_factory() { return context_factory_; }
43
38 protected: 44 protected:
39 TestViewsDelegate& views_delegate() const { return *views_delegate_.get(); } 45 TestViewsDelegate& views_delegate() const { return *views_delegate_.get(); }
40 46
41 void set_views_delegate(TestViewsDelegate* views_delegate) { 47 void set_views_delegate(TestViewsDelegate* views_delegate) {
42 views_delegate_.reset(views_delegate); 48 views_delegate_.reset(views_delegate);
43 } 49 }
44 50
45 base::MessageLoopForUI* message_loop() { return &message_loop_; } 51 base::MessageLoopForUI* message_loop() { return &message_loop_; }
46 52
47 // Returns a context view. In aura builds, this will be the 53 // Returns a context view. In aura builds, this will be the
48 // RootWindow. Everywhere else, NULL. 54 // RootWindow. Everywhere else, NULL.
49 gfx::NativeView GetContext(); 55 gfx::NativeView GetContext();
50 56
51 private: 57 private:
58 ui::ContextFactory* context_factory_;
52 base::MessageLoopForUI message_loop_; 59 base::MessageLoopForUI message_loop_;
53 scoped_ptr<TestViewsDelegate> views_delegate_; 60 scoped_ptr<TestViewsDelegate> views_delegate_;
54 scoped_ptr<ViewsTestHelper> test_helper_; 61 scoped_ptr<ViewsTestHelper> test_helper_;
55 bool setup_called_; 62 bool setup_called_;
56 bool teardown_called_; 63 bool teardown_called_;
57 64
58 #if defined(OS_WIN) 65 #if defined(OS_WIN)
59 ui::ScopedOleInitializer ole_initializer_; 66 ui::ScopedOleInitializer ole_initializer_;
60 #endif 67 #endif
61 68
62 DISALLOW_COPY_AND_ASSIGN(ViewsTestBase); 69 DISALLOW_COPY_AND_ASSIGN(ViewsTestBase);
63 }; 70 };
64 71
65 } // namespace views 72 } // namespace views
66 73
67 #endif // UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ 74 #endif // UI_VIEWS_TEST_VIEWS_TEST_BASE_H_
OLDNEW
« no previous file with comments | « ui/views/examples/content_client/examples_browser_main_parts.cc ('k') | ui/views/test/views_test_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698