OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_HELPER_MAC_H_ | 5 #ifndef UI_VIEWS_TEST_VIEWS_TEST_HELPER_MAC_H_ |
6 #define UI_VIEWS_TEST_VIEWS_TEST_HELPER_MAC_H_ | 6 #define UI_VIEWS_TEST_VIEWS_TEST_HELPER_MAC_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 "ui/views/test/views_test_helper.h" | 11 #include "ui/views/test/views_test_helper.h" |
11 | 12 |
12 namespace ui { | 13 namespace ui { |
13 namespace test { | 14 namespace test { |
14 class ScopedFakeNSWindowFocus; | 15 class ScopedFakeNSWindowFocus; |
15 class ScopedFakeNSWindowFullscreen; | 16 class ScopedFakeNSWindowFullscreen; |
16 } | 17 } |
17 class ScopedAnimationDurationScaleMode; | 18 class ScopedAnimationDurationScaleMode; |
18 } | 19 } |
19 | 20 |
20 namespace views { | 21 namespace views { |
21 | 22 |
22 class ViewsTestHelperMac : public ViewsTestHelper { | 23 class ViewsTestHelperMac : public ViewsTestHelper { |
23 public: | 24 public: |
24 ViewsTestHelperMac(); | 25 ViewsTestHelperMac(); |
25 ~ViewsTestHelperMac() override; | 26 ~ViewsTestHelperMac() override; |
26 | 27 |
27 // ViewsTestHelper: | 28 // ViewsTestHelper: |
28 void SetUp() override; | 29 void SetUp() override; |
29 void TearDown() override; | 30 void TearDown() override; |
30 | 31 |
31 private: | 32 private: |
32 // Disable animations during tests. | 33 // Disable animations during tests. |
33 scoped_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_; | 34 std::unique_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_; |
34 | 35 |
35 // When using desktop widgets on Mac, window activation is asynchronous | 36 // When using desktop widgets on Mac, window activation is asynchronous |
36 // because the window server is involved. A window may also be deactivated by | 37 // because the window server is involved. A window may also be deactivated by |
37 // a test running in parallel, making it flaky. In non-interactive/sharded | 38 // a test running in parallel, making it flaky. In non-interactive/sharded |
38 // tests, |faked_focus_| is initialized, permitting a unit test to "fake" this | 39 // tests, |faked_focus_| is initialized, permitting a unit test to "fake" this |
39 // activation, causing it to be synchronous and per-process instead. | 40 // activation, causing it to be synchronous and per-process instead. |
40 scoped_ptr<ui::test::ScopedFakeNSWindowFocus> faked_focus_; | 41 std::unique_ptr<ui::test::ScopedFakeNSWindowFocus> faked_focus_; |
41 | 42 |
42 // Toggling fullscreen mode on Mac can be flaky for tests run in parallel | 43 // Toggling fullscreen mode on Mac can be flaky for tests run in parallel |
43 // because only one window may be animating into or out of fullscreen at a | 44 // because only one window may be animating into or out of fullscreen at a |
44 // time. In non-interactive/sharded tests, |faked_fullscreen_| is initialized, | 45 // time. In non-interactive/sharded tests, |faked_fullscreen_| is initialized, |
45 // permitting a unit test to 'fake' toggling fullscreen mode. | 46 // permitting a unit test to 'fake' toggling fullscreen mode. |
46 scoped_ptr<ui::test::ScopedFakeNSWindowFullscreen> faked_fullscreen_; | 47 std::unique_ptr<ui::test::ScopedFakeNSWindowFullscreen> faked_fullscreen_; |
47 | 48 |
48 DISALLOW_COPY_AND_ASSIGN(ViewsTestHelperMac); | 49 DISALLOW_COPY_AND_ASSIGN(ViewsTestHelperMac); |
49 }; | 50 }; |
50 | 51 |
51 } // namespace views | 52 } // namespace views |
52 | 53 |
53 #endif // UI_VIEWS_TEST_VIEWS_TEST_HELPER_MAC_H_ | 54 #endif // UI_VIEWS_TEST_VIEWS_TEST_HELPER_MAC_H_ |
OLD | NEW |