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

Side by Side Diff: chrome/test/chromedriver/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, 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/chromedriver/test_util.h" 5 #include "chrome/test/chromedriver/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 RestoreKeyboardLayoutOnDestruct::RestoreKeyboardLayoutOnDestruct() { 10 RestoreKeyboardLayoutOnDestruct::RestoreKeyboardLayoutOnDestruct() {
(...skipping 12 matching lines...) Expand all
23 #elif defined(OS_MACOSX) 23 #elif defined(OS_MACOSX)
24 TISSelectInputSource(layout_); 24 TISSelectInputSource(layout_);
25 #elif defined(OS_LINUX) 25 #elif defined(OS_LINUX)
26 NOTIMPLEMENTED(); 26 NOTIMPLEMENTED();
27 #endif 27 #endif
28 } 28 }
29 29
30 #if defined(OS_WIN) 30 #if defined(OS_WIN)
31 bool SwitchKeyboardLayout(const std::string& input_locale_identifier) { 31 bool SwitchKeyboardLayout(const std::string& input_locale_identifier) {
32 HKL layout = LoadKeyboardLayout( 32 HKL layout = LoadKeyboardLayout(
33 UTF8ToWide(input_locale_identifier).c_str(), 0); 33 base::UTF8ToWide(input_locale_identifier).c_str(), 0);
34 if (!layout) 34 if (!layout)
35 return false; 35 return false;
36 return !!ActivateKeyboardLayout(layout, 0); 36 return !!ActivateKeyboardLayout(layout, 0);
37 } 37 }
38 #endif // defined(OS_WIN) 38 #endif // defined(OS_WIN)
39 39
40 #if defined(OS_MACOSX) 40 #if defined(OS_MACOSX)
41 bool SwitchKeyboardLayout(const std::string& input_source_id) { 41 bool SwitchKeyboardLayout(const std::string& input_source_id) {
42 base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> filter_dict( 42 base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> filter_dict(
43 CFDictionaryCreateMutable(kCFAllocatorDefault, 43 CFDictionaryCreateMutable(kCFAllocatorDefault,
44 1, 44 1,
45 &kCFTypeDictionaryKeyCallBacks, 45 &kCFTypeDictionaryKeyCallBacks,
46 &kCFTypeDictionaryValueCallBacks)); 46 &kCFTypeDictionaryValueCallBacks));
47 base::mac::ScopedCFTypeRef<CFStringRef> id_ref(CFStringCreateWithCString( 47 base::mac::ScopedCFTypeRef<CFStringRef> id_ref(CFStringCreateWithCString(
48 kCFAllocatorDefault, input_source_id.c_str(), kCFStringEncodingUTF8)); 48 kCFAllocatorDefault, input_source_id.c_str(), kCFStringEncodingUTF8));
49 CFDictionaryAddValue(filter_dict, kTISPropertyInputSourceID, id_ref); 49 CFDictionaryAddValue(filter_dict, kTISPropertyInputSourceID, id_ref);
50 base::mac::ScopedCFTypeRef<CFArrayRef> sources( 50 base::mac::ScopedCFTypeRef<CFArrayRef> sources(
51 TISCreateInputSourceList(filter_dict, true)); 51 TISCreateInputSourceList(filter_dict, true));
52 if (CFArrayGetCount(sources) != 1) 52 if (CFArrayGetCount(sources) != 1)
53 return false; 53 return false;
54 TISInputSourceRef source = (TISInputSourceRef)CFArrayGetValueAtIndex( 54 TISInputSourceRef source = (TISInputSourceRef)CFArrayGetValueAtIndex(
55 sources, 0); 55 sources, 0);
56 return TISSelectInputSource(source) == noErr; 56 return TISSelectInputSource(source) == noErr;
57 } 57 }
58 #endif // defined(OS_MACOSX) 58 #endif // defined(OS_MACOSX)
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/keycode_text_conversion_win.cc ('k') | chrome/test/perf/dom_checker_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698