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

Unified Diff: ui/views/test/views_test_helper_mac.mm

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/test/views_test_helper_mac.h ('k') | ui/views/test/widget_test.h » ('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.mm
diff --git a/ui/views/test/views_test_helper_mac.mm b/ui/views/test/views_test_helper_mac.mm
index 8ef73d27487d7106d4acc9b2bac3b4c38eab21ea..529d5c666b8a6a660fae5a5937dfe5f92380465f 100644
--- a/ui/views/test/views_test_helper_mac.mm
+++ b/ui/views/test/views_test_helper_mac.mm
@@ -7,6 +7,8 @@
#import <Cocoa/Cocoa.h>
#import "base/mac/scoped_nsautorelease_pool.h"
+#include "ui/base/test/scoped_fake_nswindow_focus.h"
+#include "ui/base/test/ui_controls.h"
#include "ui/compositor/scoped_animation_duration_scale_mode.h"
#include "ui/views/test/event_generator_delegate_mac.h"
#include "ui/views/widget/widget.h"
@@ -33,6 +35,16 @@ ViewsTestHelperMac::ViewsTestHelperMac()
ViewsTestHelperMac::~ViewsTestHelperMac() {
}
+void ViewsTestHelperMac::SetUp() {
+ ViewsTestHelper::SetUp();
+ // Assume that if the methods in the ui_controls.h test header are enabled
+ // then the test runner is in a non-sharded mode, and will use "real"
+ // activations. This allows interactive_ui_tests to test the actual OS window
+ // activation codepaths.
+ if (!ui_controls::IsUIControlsEnabled())
+ faked_focus_.reset(new ui::test::ScopedFakeNSWindowFocus);
+}
+
void ViewsTestHelperMac::TearDown() {
// Ensure all Widgets are closed explicitly in tests. The Widget may be
// hosting a Compositor. If that's torn down after the test ContextFactory
« no previous file with comments | « ui/views/test/views_test_helper_mac.h ('k') | ui/views/test/widget_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698