| 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 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 public: | 27 public: |
| 28 ViewsTestBase(); | 28 ViewsTestBase(); |
| 29 ~ViewsTestBase() override; | 29 ~ViewsTestBase() override; |
| 30 | 30 |
| 31 // testing::Test: | 31 // testing::Test: |
| 32 void SetUp() override; | 32 void SetUp() override; |
| 33 void TearDown() override; | 33 void TearDown() override; |
| 34 | 34 |
| 35 void RunPendingMessages(); | 35 void RunPendingMessages(); |
| 36 | 36 |
| 37 // When using desktop widgets on Mac, window activation is asynchronous |
| 38 // because the window server is involved. A window may also be deactivated by |
| 39 // a test running in parallel, making it flaky. Calling this method permits a |
| 40 // unit test to "fake" this activation, causing it to be synchronous and |
| 41 // per-process instead. Note that window activation on X11 is also |
| 42 // asynchronous, and on Windows another process may "steal" activation from a |
| 43 // parallelized unit_test run. However, a test can use non-desktop widgets |
| 44 // there instead. |
| 45 void EnableMacFakeWindowActivation(); |
| 46 |
| 37 // Creates a widget of |type| with any platform specific data for use in | 47 // Creates a widget of |type| with any platform specific data for use in |
| 38 // cross-platform tests. | 48 // cross-platform tests. |
| 39 Widget::InitParams CreateParams(Widget::InitParams::Type type); | 49 Widget::InitParams CreateParams(Widget::InitParams::Type type); |
| 40 | 50 |
| 41 protected: | 51 protected: |
| 42 TestViewsDelegate* views_delegate() const { | 52 TestViewsDelegate* views_delegate() const { |
| 43 return test_helper_->views_delegate(); | 53 return test_helper_->views_delegate(); |
| 44 } | 54 } |
| 45 | 55 |
| 46 void set_views_delegate(scoped_ptr<TestViewsDelegate> views_delegate) { | 56 void set_views_delegate(scoped_ptr<TestViewsDelegate> views_delegate) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 64 #if defined(OS_WIN) | 74 #if defined(OS_WIN) |
| 65 ui::ScopedOleInitializer ole_initializer_; | 75 ui::ScopedOleInitializer ole_initializer_; |
| 66 #endif | 76 #endif |
| 67 | 77 |
| 68 DISALLOW_COPY_AND_ASSIGN(ViewsTestBase); | 78 DISALLOW_COPY_AND_ASSIGN(ViewsTestBase); |
| 69 }; | 79 }; |
| 70 | 80 |
| 71 } // namespace views | 81 } // namespace views |
| 72 | 82 |
| 73 #endif // UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ | 83 #endif // UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ |
| OLD | NEW |