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 #ifndef UI_BASE_TEST_SCOPED_FAKE_FULL_KEYBOARD_ACCESS_H_ |
| 6 #define UI_BASE_TEST_SCOPED_FAKE_FULL_KEYBOARD_ACCESS_H_ |
| 7 |
| 8 #include <memory> |
| 9 |
| 10 #include "base/macros.h" |
| 11 |
| 12 namespace base { |
| 13 namespace mac { |
| 14 class ScopedObjCClassSwizzler; |
| 15 } |
| 16 } |
| 17 |
| 18 namespace ui { |
| 19 namespace test { |
| 20 |
| 21 // Swizzles [NSApp isFullKeyboardAccessEnabled] so that it returns the value set |
| 22 // using SetFullKeyboardAccessState. |
| 23 class ScopedFakeFullKeyboardAccess { |
| 24 public: |
| 25 ScopedFakeFullKeyboardAccess(); |
| 26 ~ScopedFakeFullKeyboardAccess(); |
| 27 |
| 28 // Set the value to be returned by [NSApp isFullKeyboardAccessEnabled]. |
| 29 void SetFullKeyboardAccessState(bool new_state); |
| 30 |
| 31 private: |
| 32 std::unique_ptr<base::mac::ScopedObjCClassSwizzler> swizzler_; |
| 33 |
| 34 DISALLOW_COPY_AND_ASSIGN(ScopedFakeFullKeyboardAccess); |
| 35 }; |
| 36 |
| 37 } // namespace test |
| 38 } // namespace ui |
| 39 |
| 40 #endif // UI_BASE_TEST_SCOPED_FAKE_FULL_KEYBOARD_ACCESS_H_ |
OLD | NEW |