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

Unified Diff: ui/base/win/osk_display_manager_unittest.cc

Issue 1986153005: The on screen keyboard on Windows 8+ should not obscure the input field. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address sky unittest review comments Created 4 years, 7 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
« no previous file with comments | « ui/base/win/osk_display_manager.cc ('k') | ui/base/win/osk_display_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/base/win/osk_display_manager_unittest.cc
diff --git a/ui/base/win/osk_display_manager_unittest.cc b/ui/base/win/osk_display_manager_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f56f61d19bd77f5e21b1a451e7b10c94bfc9f29c
--- /dev/null
+++ b/ui/base/win/osk_display_manager_unittest.cc
@@ -0,0 +1,35 @@
+// 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/base/win/osk_display_manager.h"
+
+#include "base/files/file_path.h"
+#include "base/files/file_util.h"
+#include "base/logging.h"
+#include "base/macros.h"
+#include "base/strings/string16.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+// This test validates the on screen keyboard path (tabtip.exe) which is read
+// from the registry.
+TEST(OnScreenKeyboardTest, OSKPath) {
+ ui::OnScreenKeyboardDisplayManager* keyboard_display_manager =
+ ui::OnScreenKeyboardDisplayManager::GetInstance();
+ EXPECT_NE(nullptr, keyboard_display_manager);
+
+ base::string16 osk_path;
+ EXPECT_TRUE(keyboard_display_manager->GetOSKPath(&osk_path));
+ EXPECT_FALSE(osk_path.empty());
+ EXPECT_TRUE(osk_path.find(L"tabtip.exe") != base::string16::npos);
+
+ // The path read from the registry can be quoted. To check for the existence
+ // of the file we use the base::PathExists function which internally uses the
+ // GetFileAttributes API which does not accept quoted strings. Our workaround
+ // is to look for quotes in the first and last position in the string and
+ // erase them.
+ if ((osk_path.front() == L'"') && (osk_path.back() == L'"'))
+ osk_path = osk_path.substr(1, osk_path.size() - 2);
+
+ EXPECT_TRUE(base::PathExists(base::FilePath(osk_path)));
+}
« no previous file with comments | « ui/base/win/osk_display_manager.cc ('k') | ui/base/win/osk_display_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698