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

Side by Side 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 grt review comments and add unittest 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 unified diff | Download patch
OLDNEW
(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 #include "ui/base/win/osk_display_manager.h"
6
7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h"
9 #include "base/logging.h"
10 #include "base/macros.h"
11 #include "base/strings/string16.h"
12 #include "testing/gtest/include/gtest/gtest.h"
13
14 // This test validates the on screen keyboard path (TabTip.exe) which is read
15 // from the registry.
16 TEST(OnScreenKeyboardTest, OSKPath) {
17 ui::OnScreenKeyboardDisplayManager* keyboard_display_manager =
18 ui::OnScreenKeyboardDisplayManager::GetInstance();
19 EXPECT_NE(nullptr, keyboard_display_manager);
20
21 base::string16 osk_path;
22 EXPECT_TRUE(keyboard_display_manager->GetOSKPath(&osk_path));
23
24 // The path read from the registry can be quoted. To check for the existence
25 // of the file we use the base::PathExists function which internally uses the
26 // GetFileAttributes API which does not accept quoted strings. Our workaround
27 // is to look for quotes in the first and last position in the string and
28 // erase them.
29 if (osk_path.front() == L'"') {
sky 2016/05/24 21:41:26 You should check the size too (otherwise 31 may cr
ananta 2016/05/24 22:09:33 Added some more checks above this if which removes
30 osk_path.erase(0, 1); // erase the first character.
31 osk_path.erase(osk_path.size() - 1); // erase the last character.
sky 2016/05/24 21:41:26 Can this be simplified to: osk_path = osk_path.sub
ananta 2016/05/24 22:09:33 Done.
32 }
33
34 EXPECT_TRUE(base::PathExists(base::FilePath(osk_path)));
35 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698