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

Side by Side Diff: chrome/test/webdriver/keycode_text_conversion_unittest.cc

Issue 12314090: Add utf_string_conversions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <string> 5 #include <string>
6 6
7 #include "base/string16.h" 7 #include "base/string16.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/common/automation_constants.h" 9 #include "chrome/common/automation_constants.h"
10 #include "chrome/test/webdriver/keycode_text_conversion.h" 10 #include "chrome/test/webdriver/keycode_text_conversion.h"
(...skipping 16 matching lines...) Expand all
27 int actual_modifiers = 0; 27 int actual_modifiers = 0;
28 ASSERT_TRUE(ConvertCharToKeyCode( 28 ASSERT_TRUE(ConvertCharToKeyCode(
29 character_utf16, &actual_key_code, &actual_modifiers)); 29 character_utf16, &actual_key_code, &actual_modifiers));
30 EXPECT_EQ(key_code, actual_key_code) << "Char: " << character; 30 EXPECT_EQ(key_code, actual_key_code) << "Char: " << character;
31 EXPECT_EQ(modifiers, actual_modifiers) << "Char: " << character; 31 EXPECT_EQ(modifiers, actual_modifiers) << "Char: " << character;
32 } 32 }
33 33
34 void CheckCantConvertChar(wchar_t character) { 34 void CheckCantConvertChar(wchar_t character) {
35 std::wstring character_string; 35 std::wstring character_string;
36 character_string.push_back(character); 36 character_string.push_back(character);
37 char16 character_utf16 = WideToUTF16(character_string)[0]; 37 char16 character_utf16 = base::WideToUTF16(character_string)[0];
38 ui::KeyboardCode actual_key_code = ui::VKEY_UNKNOWN; 38 ui::KeyboardCode actual_key_code = ui::VKEY_UNKNOWN;
39 int actual_modifiers = 0; 39 int actual_modifiers = 0;
40 EXPECT_FALSE(ConvertCharToKeyCode( 40 EXPECT_FALSE(ConvertCharToKeyCode(
41 character_utf16, &actual_key_code, &actual_modifiers)); 41 character_utf16, &actual_key_code, &actual_modifiers));
42 } 42 }
43 43
44 TEST(KeycodeTextConversionTest, KeyCodeToText) { 44 TEST(KeycodeTextConversionTest, KeyCodeToText) {
45 EXPECT_EQ("a", ConvertKeyCodeToText(ui::VKEY_A, 0)); 45 EXPECT_EQ("a", ConvertKeyCodeToText(ui::VKEY_A, 0));
46 EXPECT_EQ("A", ConvertKeyCodeToText(ui::VKEY_A, kShiftKeyMask)); 46 EXPECT_EQ("A", ConvertKeyCodeToText(ui::VKEY_A, kShiftKeyMask));
47 47
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 CheckCharToKeyCode(';', ui::VKEY_Q, 0); 110 CheckCharToKeyCode(';', ui::VKEY_Q, 0);
111 EXPECT_EQ(";", ConvertKeyCodeToText(ui::VKEY_Q, 0)); 111 EXPECT_EQ(";", ConvertKeyCodeToText(ui::VKEY_Q, 0));
112 #elif defined(OS_MACOSX) 112 #elif defined(OS_MACOSX)
113 ASSERT_TRUE(SwitchKeyboardLayout("com.apple.keylayout.German")); 113 ASSERT_TRUE(SwitchKeyboardLayout("com.apple.keylayout.German"));
114 CheckCharToKeyCode('z', ui::VKEY_Y, 0); 114 CheckCharToKeyCode('z', ui::VKEY_Y, 0);
115 EXPECT_EQ("z", ConvertKeyCodeToText(ui::VKEY_Y, 0)); 115 EXPECT_EQ("z", ConvertKeyCodeToText(ui::VKEY_Y, 0));
116 #endif 116 #endif
117 } 117 }
118 118
119 } // namespace webdriver 119 } // namespace webdriver
OLDNEW
« no previous file with comments | « chrome/test/webdriver/commands/file_upload_command.cc ('k') | chrome/test/webdriver/keycode_text_conversion_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698