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

Unified Diff: ui/base/test/scoped_fake_full_keyboard_access.h

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 side-by-side diff with in-line comments
Download patch
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_

Powered by Google App Engine
This is Rietveld 408576698