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

Side by Side Diff: chrome/test/webdriver/webdriver_test_util.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, 10 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 "chrome/test/webdriver/webdriver_test_util.h" 5 #include "chrome/test/webdriver/webdriver_test_util.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 9
10 namespace webdriver { 10 namespace webdriver {
(...skipping 14 matching lines...) Expand all
25 #elif defined(OS_MACOSX) 25 #elif defined(OS_MACOSX)
26 TISSelectInputSource(layout_); 26 TISSelectInputSource(layout_);
27 #elif defined(OS_LINUX) 27 #elif defined(OS_LINUX)
28 NOTIMPLEMENTED(); 28 NOTIMPLEMENTED();
29 #endif 29 #endif
30 } 30 }
31 31
32 #if defined(OS_WIN) 32 #if defined(OS_WIN)
33 bool SwitchKeyboardLayout(const std::string& input_locale_identifier) { 33 bool SwitchKeyboardLayout(const std::string& input_locale_identifier) {
34 HKL layout = LoadKeyboardLayout( 34 HKL layout = LoadKeyboardLayout(
35 UTF8ToWide(input_locale_identifier).c_str(), 0); 35 base::UTF8ToWide(input_locale_identifier).c_str(), 0);
36 if (!layout) 36 if (!layout)
37 return false; 37 return false;
38 return !!ActivateKeyboardLayout(layout, 0); 38 return !!ActivateKeyboardLayout(layout, 0);
39 } 39 }
40 #endif // defined(OS_WIN) 40 #endif // defined(OS_WIN)
41 41
42 #if defined(OS_MACOSX) 42 #if defined(OS_MACOSX)
43 bool SwitchKeyboardLayout(const std::string& input_source_id) { 43 bool SwitchKeyboardLayout(const std::string& input_source_id) {
44 base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> filter_dict( 44 base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> filter_dict(
45 CFDictionaryCreateMutable(kCFAllocatorDefault, 45 CFDictionaryCreateMutable(kCFAllocatorDefault,
46 1, 46 1,
47 &kCFTypeDictionaryKeyCallBacks, 47 &kCFTypeDictionaryKeyCallBacks,
48 &kCFTypeDictionaryValueCallBacks)); 48 &kCFTypeDictionaryValueCallBacks));
49 base::mac::ScopedCFTypeRef<CFStringRef> id_ref(CFStringCreateWithCString( 49 base::mac::ScopedCFTypeRef<CFStringRef> id_ref(CFStringCreateWithCString(
50 kCFAllocatorDefault, input_source_id.c_str(), kCFStringEncodingUTF8)); 50 kCFAllocatorDefault, input_source_id.c_str(), kCFStringEncodingUTF8));
51 CFDictionaryAddValue(filter_dict, kTISPropertyInputSourceID, id_ref); 51 CFDictionaryAddValue(filter_dict, kTISPropertyInputSourceID, id_ref);
52 base::mac::ScopedCFTypeRef<CFArrayRef> sources( 52 base::mac::ScopedCFTypeRef<CFArrayRef> sources(
53 TISCreateInputSourceList(filter_dict, true)); 53 TISCreateInputSourceList(filter_dict, true));
54 if (CFArrayGetCount(sources) != 1) 54 if (CFArrayGetCount(sources) != 1)
55 return false; 55 return false;
56 TISInputSourceRef source = (TISInputSourceRef)CFArrayGetValueAtIndex( 56 TISInputSourceRef source = (TISInputSourceRef)CFArrayGetValueAtIndex(
57 sources, 0); 57 sources, 0);
58 return TISSelectInputSource(source) == noErr; 58 return TISSelectInputSource(source) == noErr;
59 } 59 }
60 #endif // defined(OS_WIN) 60 #endif // defined(OS_WIN)
61 61
62 } // namespace webdriver 62 } // namespace webdriver
OLDNEW
« no previous file with comments | « chrome/test/webdriver/webdriver_key_converter_unittest.cc ('k') | chrome/tools/convert_dict/aff_reader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698