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

Side by Side Diff: ui/base/test/scoped_fake_full_keyboard_access.mm

Issue 1894383002: MacViews: Implement Full Keyboard Access. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@SetFocusBehavior
Patch Set: Rebased. Created 4 years, 8 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #import "ui/base/test/scoped_fake_full_keyboard_access.h"
6
7 #import <Cocoa/Cocoa.h>
8
9 #import "base/mac/scoped_objc_class_swizzler.h"
10
11 namespace {
12
13 bool g_full_keyboard_access_mode = false;
tapted 2016/04/20 06:05:57 A lot of tests depend on traversing or setting foc
karandeepb 2016/05/03 02:54:12 Yeah I didn't take into account that these tests m
14
15 } // namespace
16
17 // Donates testing implementation of [NSApp isFullKeyboardAccessEnabled].
tapted 2016/04/20 06:05:57 nit: testing -> a testing
karandeepb 2016/05/03 02:54:12 Done.
18 @interface FakeNSAppKeyboardAccessDonor : NSObject
19 @end
20
21 @implementation FakeNSAppKeyboardAccessDonor
22
23 - (BOOL)isFullKeyboardAccessEnabled {
24 return g_full_keyboard_access_mode;
25 }
26
27 @end
28
29 namespace ui {
30 namespace test {
31
32 ScopedFakeFullKeyboardAccess::ScopedFakeFullKeyboardAccess()
33 : swizzler_(new base::mac::ScopedObjCClassSwizzler(
34 [NSApplication class],
35 [FakeNSAppKeyboardAccessDonor class],
36 @selector(isFullKeyboardAccessEnabled))) {}
37
38 ScopedFakeFullKeyboardAccess::~ScopedFakeFullKeyboardAccess() {}
39
40 void ScopedFakeFullKeyboardAccess::SetFullKeyboardAccessState(bool new_state) {
41 g_full_keyboard_access_mode = new_state;
tapted 2016/04/20 06:05:57 we need to test the notifications too. That is, wh
karandeepb 2016/05/03 02:54:12 I can't get broadcasting notifications to NSDistri
tapted 2016/05/03 08:08:25 Hum - that starts to get into the realms of things
42 }
43
44 } // namespace test
45 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698