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

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

Issue 1782773002: MacViews: Fix ViewTest.HandleAccelerator by faking window activation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Faked activations for everyone! Created 4 years, 9 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
OLDNEW
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 "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "ui/views/test/views_test_helper.h" 10 #include "ui/views/test/views_test_helper.h"
11 11
12 namespace ui { 12 namespace ui {
13 namespace test {
14 class ScopedFakeNSWindowFocus;
15 }
13 class ScopedAnimationDurationScaleMode; 16 class ScopedAnimationDurationScaleMode;
14 } 17 }
15 18
16 namespace views { 19 namespace views {
17 20
18 class ViewsTestHelperMac : public ViewsTestHelper { 21 class ViewsTestHelperMac : public ViewsTestHelper {
19 public: 22 public:
20 ViewsTestHelperMac(); 23 ViewsTestHelperMac();
21 ~ViewsTestHelperMac() override; 24 ~ViewsTestHelperMac() override;
22 25
23 // ViewsTestHelper: 26 // ViewsTestHelper:
27 void SetUp() override;
24 void TearDown() override; 28 void TearDown() override;
25 29
26 private: 30 private:
27 // Disable animations during tests. 31 // Disable animations during tests.
28 scoped_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_; 32 scoped_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_;
29 33
34 // When using desktop widgets on Mac, window activation is asynchronous
35 // because the window server is involved. A window may also be deactivated by
36 // a test running in parallel, making it flaky. In non-interactive/sharded
37 // tests, |faked_focus_| is initialized, permitting a unit test to "fake" this
38 // activation, causing it to be synchronous and per-process instead.
39 scoped_ptr<ui::test::ScopedFakeNSWindowFocus> faked_focus_;
40
30 DISALLOW_COPY_AND_ASSIGN(ViewsTestHelperMac); 41 DISALLOW_COPY_AND_ASSIGN(ViewsTestHelperMac);
31 }; 42 };
32 43
33 } // namespace views 44 } // namespace views
34 45
35 #endif // UI_VIEWS_TEST_VIEWS_TEST_HELPER_MAC_H_ 46 #endif // UI_VIEWS_TEST_VIEWS_TEST_HELPER_MAC_H_
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield_unittest.cc ('k') | ui/views/test/views_test_helper_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698