| 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_path.h" |
| 15 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 16 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 17 #include "base/rand_util.h" | 18 #include "base/rand_util.h" |
| 18 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 19 #include "chrome/common/chrome_paths.h" | 20 #include "chrome/common/chrome_paths.h" |
| 20 #include "chrome/test/automation/tab_proxy.h" | 21 #include "chrome/test/automation/tab_proxy.h" |
| 21 #include "chrome/test/automation/window_proxy.h" | 22 #include "chrome/test/automation/window_proxy.h" |
| 22 #include "chrome/test/ui/ui_test.h" | 23 #include "chrome/test/ui/ui_test.h" |
| 23 #include "net/base/net_util.h" | 24 #include "net/base/net_util.h" |
| 24 | 25 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 std::wstring test_path; | 95 std::wstring test_path; |
| 95 PathService::Get(chrome::DIR_TEST_DATA, &test_path); | 96 PathService::Get(chrome::DIR_TEST_DATA, &test_path); |
| 96 file_util::UpOneDirectory(&test_path); | 97 file_util::UpOneDirectory(&test_path); |
| 97 file_util::UpOneDirectory(&test_path); | 98 file_util::UpOneDirectory(&test_path); |
| 98 file_util::UpOneDirectory(&test_path); | 99 file_util::UpOneDirectory(&test_path); |
| 99 file_util::AppendToPath(&test_path, L"data"); | 100 file_util::AppendToPath(&test_path, L"data"); |
| 100 file_util::AppendToPath(&test_path, L"selenium_core"); | 101 file_util::AppendToPath(&test_path, L"selenium_core"); |
| 101 file_util::AppendToPath(&test_path, L"core"); | 102 file_util::AppendToPath(&test_path, L"core"); |
| 102 file_util::AppendToPath(&test_path, L"TestRunner.html"); | 103 file_util::AppendToPath(&test_path, L"TestRunner.html"); |
| 103 | 104 |
| 104 GURL test_url(net::FilePathToFileURL(test_path)); | 105 GURL test_url(net::FilePathToFileURL(FilePath::FromWStringHack(test_path))); |
| 105 scoped_ptr<TabProxy> tab(GetActiveTab()); | 106 scoped_ptr<TabProxy> tab(GetActiveTab()); |
| 106 tab->NavigateToURL(test_url); | 107 tab->NavigateToURL(test_url); |
| 107 | 108 |
| 108 // Wait for the test to finish. | 109 // Wait for the test to finish. |
| 109 ASSERT_TRUE(WaitUntilCookieValue(tab.get(), test_url, "__tests_finished", | 110 ASSERT_TRUE(WaitUntilCookieValue(tab.get(), test_url, "__tests_finished", |
| 110 3000, UITest::test_timeout_ms(), "1")); | 111 3000, UITest::test_timeout_ms(), "1")); |
| 111 | 112 |
| 112 std::string cookie; | 113 std::string cookie; |
| 113 ASSERT_TRUE(tab->GetCookieByName(test_url, "__num_tests_total", &cookie)); | 114 ASSERT_TRUE(tab->GetCookieByName(test_url, "__num_tests_total", &cookie)); |
| 114 total->swap(UTF8ToWide(cookie)); | 115 total->swap(UTF8ToWide(cookie)); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 164 } |
| 164 | 165 |
| 165 if (!new_passes_list.empty()) { | 166 if (!new_passes_list.empty()) { |
| 166 printf("new tests passing:\n"); | 167 printf("new tests passing:\n"); |
| 167 ResultsList::const_iterator it = new_passes_list.begin(); | 168 ResultsList::const_iterator it = new_passes_list.begin(); |
| 168 for (; it != new_passes_list.end(); ++it) | 169 for (; it != new_passes_list.end(); ++it) |
| 169 printf(" %s\n", it->c_str()); | 170 printf(" %s\n", it->c_str()); |
| 170 printf("\n"); | 171 printf("\n"); |
| 171 } | 172 } |
| 172 } | 173 } |
| OLD | NEW |