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

Side by Side Diff: chrome/test/automated_ui_tests/automated_ui_tests.cc

Issue 21414: We will sort the encoding menu items according to current used UI language ex... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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
« no previous file with comments | « chrome/common/l10n_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <fstream> 5 #include <fstream>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/rand_util.h" 11 #include "base/rand_util.h"
12 #include "base/string_util.h" 12 #include "base/string_util.h"
13 #include "base/sys_info.h" 13 #include "base/sys_info.h"
14 #include "chrome/app/chrome_dll_resource.h" 14 #include "chrome/app/chrome_dll_resource.h"
15 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/character_encoding.h" 16 #include "chrome/browser/character_encoding.h"
16 #include "chrome/browser/view_ids.h" 17 #include "chrome/browser/view_ids.h"
17 #include "chrome/common/chrome_paths.h" 18 #include "chrome/common/chrome_paths.h"
18 #include "chrome/common/env_vars.h" 19 #include "chrome/common/env_vars.h"
19 #include "chrome/common/libxml_utils.h" 20 #include "chrome/common/libxml_utils.h"
20 #include "chrome/common/win_util.h" 21 #include "chrome/common/win_util.h"
21 #include "chrome/test/automated_ui_tests/automated_ui_tests.h" 22 #include "chrome/test/automated_ui_tests/automated_ui_tests.h"
22 #include "chrome/test/automation/browser_proxy.h" 23 #include "chrome/test/automation/browser_proxy.h"
23 #include "chrome/test/automation/tab_proxy.h" 24 #include "chrome/test/automation/tab_proxy.h"
24 #include "chrome/test/automation/window_proxy.h" 25 #include "chrome/test/automation/window_proxy.h"
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 } 414 }
414 return true; 415 return true;
415 } 416 }
416 417
417 bool AutomatedUITest::BackButton() { 418 bool AutomatedUITest::BackButton() {
418 return RunCommand(IDC_BACK); 419 return RunCommand(IDC_BACK);
419 } 420 }
420 421
421 bool AutomatedUITest::ChangeEncoding() { 422 bool AutomatedUITest::ChangeEncoding() {
422 // Get the encoding list that is used to populate the UI (encoding menu) 423 // Get the encoding list that is used to populate the UI (encoding menu)
423 const std::vector<int>* encoding_ids = 424 std::wstring cur_locale = g_browser_process->GetApplicationLocale();
425 const std::vector<CharacterEncoding::EncodingInfo>* encodings =
424 CharacterEncoding::GetCurrentDisplayEncodings( 426 CharacterEncoding::GetCurrentDisplayEncodings(
425 L"ISO-8859-1,windows-1252", L""); 427 cur_locale, L"ISO-8859-1,windows-1252", L"");
426 DCHECK(encoding_ids); 428 DCHECK(encodings);
427 DCHECK(!encoding_ids->empty()); 429 DCHECK(!encodings->empty());
428 unsigned len = static_cast<unsigned>(encoding_ids->size()); 430 unsigned len = static_cast<unsigned>(encodings->size());
429 431
430 // The vector will contain mostly IDC values for encoding commands plus a few 432 // The vector will contain mostly IDC values for encoding commands plus a few
431 // menu separators (0 values). If we hit a separator we just retry. 433 // menu separators (0 values). If we hit a separator we just retry.
432 int index = base::RandInt(0, len); 434 int index = base::RandInt(0, len);
433 while ((*encoding_ids)[index] == 0) { 435 while ((*encodings)[index].encoding_id == 0) {
434 index = base::RandInt(0, len); 436 index = base::RandInt(0, len);
435 } 437 }
436 438
437 return RunCommand((*encoding_ids)[index]); 439 return RunCommand((*encodings)[index].encoding_id);
438 } 440 }
439 441
440 bool AutomatedUITest::CloseActiveTab() { 442 bool AutomatedUITest::CloseActiveTab() {
441 bool return_value = false; 443 bool return_value = false;
442 scoped_ptr<BrowserProxy> browser(automation()->GetLastActiveBrowserWindow()); 444 scoped_ptr<BrowserProxy> browser(automation()->GetLastActiveBrowserWindow());
443 if (browser.get() == NULL) { 445 if (browser.get() == NULL) {
444 AddErrorAttribute("browser_window_not_found"); 446 AddErrorAttribute("browser_window_not_found");
445 return false; 447 return false;
446 } 448 }
447 int browser_windows_count; 449 int browser_windows_count;
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 } 1010 }
1009 } 1011 }
1010 1012
1011 TEST_F(AutomatedUITest, TheOneAndOnlyTest) { 1013 TEST_F(AutomatedUITest, TheOneAndOnlyTest) {
1012 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); 1014 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
1013 if (parsed_command_line.HasSwitch(kReproSwitch)) 1015 if (parsed_command_line.HasSwitch(kReproSwitch))
1014 RunReproduction(); 1016 RunReproduction();
1015 else 1017 else
1016 RunAutomatedUITest(); 1018 RunAutomatedUITest();
1017 } 1019 }
OLDNEW
« no previous file with comments | « chrome/common/l10n_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698