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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/test/views_test_helper_mac.h
diff --git a/ui/views/test/views_test_helper_mac.h b/ui/views/test/views_test_helper_mac.h
index 31fc0d8d09289aa3220eb97e138729ec3b4719bb..6dbb253e0fa647c169b6e4254fa201a1bd639d1b 100644
--- a/ui/views/test/views_test_helper_mac.h
+++ b/ui/views/test/views_test_helper_mac.h
@@ -10,6 +10,9 @@
#include "ui/views/test/views_test_helper.h"
namespace ui {
+namespace test {
+class ScopedFakeNSWindowFocus;
+}
class ScopedAnimationDurationScaleMode;
}
@@ -21,12 +24,20 @@ class ViewsTestHelperMac : public ViewsTestHelper {
~ViewsTestHelperMac() override;
// ViewsTestHelper:
+ void SetUp() override;
void TearDown() override;
private:
// Disable animations during tests.
scoped_ptr<ui::ScopedAnimationDurationScaleMode> zero_duration_mode_;
+ // When using desktop widgets on Mac, window activation is asynchronous
+ // because the window server is involved. A window may also be deactivated by
+ // a test running in parallel, making it flaky. In non-interactive/sharded
+ // tests, |faked_focus_| is initialized, permitting a unit test to "fake" this
+ // activation, causing it to be synchronous and per-process instead.
+ scoped_ptr<ui::test::ScopedFakeNSWindowFocus> faked_focus_;
+
DISALLOW_COPY_AND_ASSIGN(ViewsTestHelperMac);
};
« 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