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

Side by Side Diff: chrome/browser/browser_keyevents_browsertest.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 } 198 }
199 } 199 }
200 200
201 void CheckFocusedElement(int tab_index, const wchar_t* focused) { 201 void CheckFocusedElement(int tab_index, const wchar_t* focused) {
202 ASSERT_LT(tab_index, browser()->tab_strip_model()->count()); 202 ASSERT_LT(tab_index, browser()->tab_strip_model()->count());
203 std::string actual; 203 std::string actual;
204 ASSERT_TRUE(content::ExecuteScriptAndExtractString( 204 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
205 browser()->tab_strip_model()->GetWebContentsAt(tab_index), 205 browser()->tab_strip_model()->GetWebContentsAt(tab_index),
206 kGetFocusedElementJS, 206 kGetFocusedElementJS,
207 &actual)); 207 &actual));
208 ASSERT_EQ(WideToUTF8(focused), actual); 208 ASSERT_EQ(base::WideToUTF8(focused), actual);
209 } 209 }
210 210
211 void SetFocusedElement(int tab_index, const wchar_t* focused) { 211 void SetFocusedElement(int tab_index, const wchar_t* focused) {
212 ASSERT_LT(tab_index, browser()->tab_strip_model()->count()); 212 ASSERT_LT(tab_index, browser()->tab_strip_model()->count());
213 bool actual; 213 bool actual;
214 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( 214 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
215 browser()->tab_strip_model()->GetWebContentsAt(tab_index), 215 browser()->tab_strip_model()->GetWebContentsAt(tab_index),
216 base::StringPrintf(kSetFocusedElementJS, focused), 216 base::StringPrintf(kSetFocusedElementJS, focused),
217 &actual)); 217 &actual));
218 ASSERT_TRUE(actual); 218 ASSERT_TRUE(actual);
219 } 219 }
220 220
221 void CheckTextBoxValue(int tab_index, const wchar_t* id, 221 void CheckTextBoxValue(int tab_index, const wchar_t* id,
222 const wchar_t* value) { 222 const wchar_t* value) {
223 ASSERT_LT(tab_index, browser()->tab_strip_model()->count()); 223 ASSERT_LT(tab_index, browser()->tab_strip_model()->count());
224 std::string actual; 224 std::string actual;
225 ASSERT_TRUE(content::ExecuteScriptAndExtractString( 225 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
226 browser()->tab_strip_model()->GetWebContentsAt(tab_index), 226 browser()->tab_strip_model()->GetWebContentsAt(tab_index),
227 base::StringPrintf(kGetTextBoxValueJS, id), 227 base::StringPrintf(kGetTextBoxValueJS, id),
228 &actual)); 228 &actual));
229 ASSERT_EQ(WideToUTF8(value), actual); 229 ASSERT_EQ(base::WideToUTF8(value), actual);
230 } 230 }
231 231
232 void SetTextBoxValue(int tab_index, const wchar_t* id, 232 void SetTextBoxValue(int tab_index, const wchar_t* id,
233 const wchar_t* value) { 233 const wchar_t* value) {
234 ASSERT_LT(tab_index, browser()->tab_strip_model()->count()); 234 ASSERT_LT(tab_index, browser()->tab_strip_model()->count());
235 std::string actual; 235 std::string actual;
236 ASSERT_TRUE(content::ExecuteScriptAndExtractString( 236 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
237 browser()->tab_strip_model()->GetWebContentsAt(tab_index), 237 browser()->tab_strip_model()->GetWebContentsAt(tab_index),
238 base::StringPrintf(kSetTextBoxValueJS, id, value), 238 base::StringPrintf(kSetTextBoxValueJS, id, value),
239 &actual)); 239 &actual));
240 ASSERT_EQ(WideToUTF8(value), actual); 240 ASSERT_EQ(base::WideToUTF8(value), actual);
241 } 241 }
242 242
243 void StartTest(int tab_index, int result_length) { 243 void StartTest(int tab_index, int result_length) {
244 ASSERT_LT(tab_index, browser()->tab_strip_model()->count()); 244 ASSERT_LT(tab_index, browser()->tab_strip_model()->count());
245 bool actual; 245 bool actual;
246 ASSERT_TRUE(content::ExecuteScriptAndExtractBool( 246 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(
247 browser()->tab_strip_model()->GetWebContentsAt(tab_index), 247 browser()->tab_strip_model()->GetWebContentsAt(tab_index),
248 base::StringPrintf(kStartTestJS, result_length), 248 base::StringPrintf(kStartTestJS, result_length),
249 &actual)); 249 &actual));
250 ASSERT_TRUE(actual); 250 ASSERT_TRUE(actual);
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKeySuppress)); 886 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKeySuppress));
887 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); 887 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
888 888
889 // Ctrl+Alt should have no effect. 889 // Ctrl+Alt should have no effect.
890 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlAltKey)); 890 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlAltKey));
891 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); 891 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
892 } 892 }
893 #endif 893 #endif
894 894
895 } // namespace 895 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_utils_unittest.cc ('k') | chrome/browser/chrome_browser_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698