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

Unified Diff: ui/events/test/keyboard_layout.cc

Issue 2197113002: Force U.S. English keyboard layout for TextfieldTest.KeysWithModifiersTest (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Share keyboard layout selection code between tests Created 4 years, 4 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/events/test/keyboard_layout.cc
diff --git a/ui/events/test/keyboard_layout.cc b/ui/events/test/keyboard_layout.cc
new file mode 100644
index 0000000000000000000000000000000000000000..352fed7c7e5cbe47b70da40db23d6e6bba577346
--- /dev/null
+++ b/ui/events/test/keyboard_layout.cc
@@ -0,0 +1,23 @@
+// 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.
+
+#include "ui/events/test/keyboard_layout.h"
+
+#if defined(OS_WIN) || defined(OS_MACOSX)
+#include "base/logging.h"
+
+namespace ui {
+
+ScopedKeyboardLayout::ScopedKeyboardLayout(KeyboardLayout layout) {
+ original_layout_ = GetActiveLayout();
+ CHECK(ActivateLayout(GetPlatformKeyboardLayout(layout)));
Peter Kasting 2016/08/18 17:48:19 Nit: We normally use CHECK only for security-sensi
Tomasz Moniuszko 2016/08/26 08:53:12 Done.
+}
+
+ScopedKeyboardLayout::~ScopedKeyboardLayout() {
+ ActivateLayout(original_layout_);
+}
+
+} // namespace ui
+
+#endif // defined(OS_WIN) || defined(OS_MACOSX)

Powered by Google App Engine
This is Rietveld 408576698