Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 | |
| OLD | NEW |