| 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 <memory> |
| 9 |
| 8 #include "base/macros.h" | 10 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | |
| 10 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "testing/platform_test.h" | 14 #include "testing/platform_test.h" |
| 14 #include "ui/views/test/scoped_views_test_helper.h" | 15 #include "ui/views/test/scoped_views_test_helper.h" |
| 15 #include "ui/views/test/test_views_delegate.h" | 16 #include "ui/views/test/test_views_delegate.h" |
| 16 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
| 17 | 18 |
| 18 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
| 19 #include "ui/base/win/scoped_ole_initializer.h" | 20 #include "ui/base/win/scoped_ole_initializer.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 42 // would use an ifdef, but for the time being we're not compiling differently, | 43 // would use an ifdef, but for the time being we're not compiling differently, |
| 43 // so that a define is not possible. | 44 // so that a define is not possible. |
| 44 void DisableNativeWidgetMus(); | 45 void DisableNativeWidgetMus(); |
| 45 bool IsMus() const; | 46 bool IsMus() const; |
| 46 | 47 |
| 47 protected: | 48 protected: |
| 48 TestViewsDelegate* views_delegate() const { | 49 TestViewsDelegate* views_delegate() const { |
| 49 return test_helper_->views_delegate(); | 50 return test_helper_->views_delegate(); |
| 50 } | 51 } |
| 51 | 52 |
| 52 void set_views_delegate(scoped_ptr<TestViewsDelegate> views_delegate) { | 53 void set_views_delegate(std::unique_ptr<TestViewsDelegate> views_delegate) { |
| 53 DCHECK(!setup_called_); | 54 DCHECK(!setup_called_); |
| 54 views_delegate_for_setup_.swap(views_delegate); | 55 views_delegate_for_setup_.swap(views_delegate); |
| 55 } | 56 } |
| 56 | 57 |
| 57 base::MessageLoopForUI* message_loop() { return &message_loop_; } | 58 base::MessageLoopForUI* message_loop() { return &message_loop_; } |
| 58 | 59 |
| 59 // Returns a context view. In aura builds, this will be the | 60 // Returns a context view. In aura builds, this will be the |
| 60 // RootWindow. Everywhere else, NULL. | 61 // RootWindow. Everywhere else, NULL. |
| 61 gfx::NativeWindow GetContext(); | 62 gfx::NativeWindow GetContext(); |
| 62 | 63 |
| 63 private: | 64 private: |
| 64 base::MessageLoopForUI message_loop_; | 65 base::MessageLoopForUI message_loop_; |
| 65 scoped_ptr<TestViewsDelegate> views_delegate_for_setup_; | 66 std::unique_ptr<TestViewsDelegate> views_delegate_for_setup_; |
| 66 scoped_ptr<ScopedViewsTestHelper> test_helper_; | 67 std::unique_ptr<ScopedViewsTestHelper> test_helper_; |
| 67 bool setup_called_; | 68 bool setup_called_; |
| 68 bool teardown_called_; | 69 bool teardown_called_; |
| 69 | 70 |
| 70 #if defined(OS_WIN) | 71 #if defined(OS_WIN) |
| 71 ui::ScopedOleInitializer ole_initializer_; | 72 ui::ScopedOleInitializer ole_initializer_; |
| 72 #endif | 73 #endif |
| 73 | 74 |
| 74 DISALLOW_COPY_AND_ASSIGN(ViewsTestBase); | 75 DISALLOW_COPY_AND_ASSIGN(ViewsTestBase); |
| 75 }; | 76 }; |
| 76 | 77 |
| 77 } // namespace views | 78 } // namespace views |
| 78 | 79 |
| 79 #endif // UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ | 80 #endif // UI_VIEWS_TEST_VIEWS_TEST_BASE_H_ |
| OLD | NEW |