OLD | NEW |
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 // This is a gTest-based test that runs the Selenium Core testsuite in Chrome | 5 // This is a gTest-based test that runs the Selenium Core testsuite in Chrome |
6 // using the UITest automation. The number of total and failed tests are | 6 // using the UITest automation. The number of total and failed tests are |
7 // written to stdout. | 7 // written to stdout. |
8 // | 8 // |
9 // TODO(darin): output the names of the failed tests so we can easily track | 9 // TODO(darin): output the names of the failed tests so we can easily track |
10 // deviations from the expected output. | 10 // deviations from the expected output. |
11 | 11 |
12 #include <list> | 12 #include <list> |
13 #include <set> | 13 #include <set> |
14 | 14 |
15 #include "base/file_util.h" | 15 #include "base/file_util.h" |
16 #include "base/path_service.h" | 16 #include "base/path_service.h" |
| 17 #include "base/rand_util.h" |
17 #include "base/string_util.h" | 18 #include "base/string_util.h" |
18 #include "chrome/common/chrome_paths.h" | 19 #include "chrome/common/chrome_paths.h" |
19 #include "chrome/common/rand_util.h" | |
20 #include "chrome/test/automation/tab_proxy.h" | 20 #include "chrome/test/automation/tab_proxy.h" |
21 #include "chrome/test/automation/window_proxy.h" | 21 #include "chrome/test/automation/window_proxy.h" |
22 #include "chrome/test/ui/ui_test.h" | 22 #include "chrome/test/ui/ui_test.h" |
23 #include "net/base/net_util.h" | 23 #include "net/base/net_util.h" |
24 | 24 |
25 // Uncomment this to exercise this test without actually running the selenium | 25 // Uncomment this to exercise this test without actually running the selenium |
26 // test, which can take a while to run. This define is useful when modifying | 26 // test, which can take a while to run. This define is useful when modifying |
27 // the analysis code. | 27 // the analysis code. |
28 //#define SIMULATE_RUN 1 | 28 //#define SIMULATE_RUN 1 |
29 | 29 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 81 } |
82 | 82 |
83 void RunSelenium(std::wstring* total, std::wstring* failed) { | 83 void RunSelenium(std::wstring* total, std::wstring* failed) { |
84 #ifdef SIMULATE_RUN | 84 #ifdef SIMULATE_RUN |
85 *total = L"100"; | 85 *total = L"100"; |
86 const wchar_t* kBogusFailures[] = { | 86 const wchar_t* kBogusFailures[] = { |
87 L"5.selectFrame,6.click,24.selectAndWait,24.verifyTitle", | 87 L"5.selectFrame,6.click,24.selectAndWait,24.verifyTitle", |
88 L"5.selectFrame,6.click,13.verifyLocation,13.verifyLocation,13.click,24.se
lectAndWait,24.verifyTitle", | 88 L"5.selectFrame,6.click,13.verifyLocation,13.verifyLocation,13.click,24.se
lectAndWait,24.verifyTitle", |
89 L"5.selectFrame,6.click,24.selectAndWait" | 89 L"5.selectFrame,6.click,24.selectAndWait" |
90 }; | 90 }; |
91 *failed = kBogusFailures[rand_util::RandInt(0, 2)]; | 91 *failed = kBogusFailures[base::RandInt(0, 2)]; |
92 #else | 92 #else |
93 std::wstring test_path; | 93 std::wstring test_path; |
94 PathService::Get(chrome::DIR_TEST_DATA, &test_path); | 94 PathService::Get(chrome::DIR_TEST_DATA, &test_path); |
95 file_util::UpOneDirectory(&test_path); | 95 file_util::UpOneDirectory(&test_path); |
96 file_util::UpOneDirectory(&test_path); | 96 file_util::UpOneDirectory(&test_path); |
97 file_util::UpOneDirectory(&test_path); | 97 file_util::UpOneDirectory(&test_path); |
98 file_util::AppendToPath(&test_path, L"data"); | 98 file_util::AppendToPath(&test_path, L"data"); |
99 file_util::AppendToPath(&test_path, L"selenium_core"); | 99 file_util::AppendToPath(&test_path, L"selenium_core"); |
100 file_util::AppendToPath(&test_path, L"core"); | 100 file_util::AppendToPath(&test_path, L"core"); |
101 file_util::AppendToPath(&test_path, L"TestRunner.html"); | 101 file_util::AppendToPath(&test_path, L"TestRunner.html"); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 if (!new_passes_list.empty()) { | 164 if (!new_passes_list.empty()) { |
165 printf("new tests passing:\n"); | 165 printf("new tests passing:\n"); |
166 ResultsList::const_iterator it = new_passes_list.begin(); | 166 ResultsList::const_iterator it = new_passes_list.begin(); |
167 for (; it != new_passes_list.end(); ++it) | 167 for (; it != new_passes_list.end(); ++it) |
168 printf(" %s\n", it->c_str()); | 168 printf(" %s\n", it->c_str()); |
169 printf("\n"); | 169 printf("\n"); |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
OLD | NEW |