Index: ui/base/test/scoped_fake_full_keyboard_access.h |
diff --git a/ui/base/test/scoped_fake_full_keyboard_access.h b/ui/base/test/scoped_fake_full_keyboard_access.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..81d1852cbfe1eede66e02604c1aa206915be73c0 |
--- /dev/null |
+++ b/ui/base/test/scoped_fake_full_keyboard_access.h |
@@ -0,0 +1,40 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef UI_BASE_TEST_SCOPED_FAKE_FULL_KEYBOARD_ACCESS_H_ |
+#define UI_BASE_TEST_SCOPED_FAKE_FULL_KEYBOARD_ACCESS_H_ |
+ |
+#include <memory> |
+ |
+#include "base/macros.h" |
+ |
+namespace base { |
+namespace mac { |
+class ScopedObjCClassSwizzler; |
+} |
+} |
+ |
+namespace ui { |
+namespace test { |
+ |
+// Swizzles [NSApp isFullKeyboardAccessEnabled] so that it returns the value set |
+// using SetFullKeyboardAccessState. |
+class ScopedFakeFullKeyboardAccess { |
+ public: |
+ ScopedFakeFullKeyboardAccess(); |
+ ~ScopedFakeFullKeyboardAccess(); |
+ |
+ // Set the value to be returned by [NSApp isFullKeyboardAccessEnabled]. |
+ void SetFullKeyboardAccessState(bool new_state); |
+ |
+ private: |
+ std::unique_ptr<base::mac::ScopedObjCClassSwizzler> swizzler_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ScopedFakeFullKeyboardAccess); |
+}; |
+ |
+} // namespace test |
+} // namespace ui |
+ |
+#endif // UI_BASE_TEST_SCOPED_FAKE_FULL_KEYBOARD_ACCESS_H_ |