| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_path.h" |
| 16 #include "base/file_util.h" | 16 #include "base/file_util.h" |
| 17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
| 18 #include "base/string_split.h" | 18 #include "base/string_split.h" |
| 19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 20 #include "base/test/test_timeouts.h" |
| 20 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
| 21 #include "chrome/common/chrome_paths.h" | 22 #include "chrome/common/chrome_paths.h" |
| 22 #include "chrome/test/automation/tab_proxy.h" | 23 #include "chrome/test/automation/tab_proxy.h" |
| 23 #include "chrome/test/automation/window_proxy.h" | 24 #include "chrome/test/automation/window_proxy.h" |
| 24 #include "chrome/test/ui/ui_test.h" | 25 #include "chrome/test/ui/ui_test.h" |
| 25 #include "net/base/net_util.h" | 26 #include "net/base/net_util.h" |
| 26 | 27 |
| 27 #ifdef SIMULATE_RUN | 28 #ifdef SIMULATE_RUN |
| 28 #include "base/rand_util.h" | 29 #include "base/rand_util.h" |
| 29 #endif | 30 #endif |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 test_path = test_path.AppendASCII("data"); | 105 test_path = test_path.AppendASCII("data"); |
| 105 test_path = test_path.AppendASCII("selenium_core"); | 106 test_path = test_path.AppendASCII("selenium_core"); |
| 106 test_path = test_path.AppendASCII("core"); | 107 test_path = test_path.AppendASCII("core"); |
| 107 test_path = test_path.AppendASCII("TestRunner.html"); | 108 test_path = test_path.AppendASCII("TestRunner.html"); |
| 108 | 109 |
| 109 GURL test_url(net::FilePathToFileURL(test_path)); | 110 GURL test_url(net::FilePathToFileURL(test_path)); |
| 110 scoped_refptr<TabProxy> tab(GetActiveTab()); | 111 scoped_refptr<TabProxy> tab(GetActiveTab()); |
| 111 tab->NavigateToURL(test_url); | 112 tab->NavigateToURL(test_url); |
| 112 | 113 |
| 113 // Wait for the test to finish. | 114 // Wait for the test to finish. |
| 114 ASSERT_TRUE(WaitUntilCookieValue(tab.get(), test_url, "__tests_finished", | 115 ASSERT_TRUE(WaitUntilCookieValue( |
| 115 UITest::test_timeout_ms(), "1")); | 116 tab.get(), test_url, "__tests_finished", |
| 117 TestTimeouts::huge_test_timeout_ms(), "1")); |
| 116 | 118 |
| 117 std::string cookie; | 119 std::string cookie; |
| 118 ASSERT_TRUE(tab->GetCookieByName(test_url, "__num_tests_total", &cookie)); | 120 ASSERT_TRUE(tab->GetCookieByName(test_url, "__num_tests_total", &cookie)); |
| 119 total->swap(UTF8ToWide(cookie)); | 121 total->swap(UTF8ToWide(cookie)); |
| 120 ASSERT_FALSE(total->empty()); | 122 ASSERT_FALSE(total->empty()); |
| 121 ASSERT_TRUE(tab->GetCookieByName(test_url, "__tests_failed", &cookie)); | 123 ASSERT_TRUE(tab->GetCookieByName(test_url, "__tests_failed", &cookie)); |
| 122 failed->swap(UTF8ToWide(cookie)); | 124 failed->swap(UTF8ToWide(cookie)); |
| 123 // The __tests_failed cookie will be empty if all the tests pass. | 125 // The __tests_failed cookie will be empty if all the tests pass. |
| 124 #endif | 126 #endif |
| 125 } | 127 } |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 170 } |
| 169 | 171 |
| 170 if (!new_passes_list.empty()) { | 172 if (!new_passes_list.empty()) { |
| 171 printf("new tests passing:\n"); | 173 printf("new tests passing:\n"); |
| 172 ResultsList::const_iterator it = new_passes_list.begin(); | 174 ResultsList::const_iterator it = new_passes_list.begin(); |
| 173 for (; it != new_passes_list.end(); ++it) | 175 for (; it != new_passes_list.end(); ++it) |
| 174 printf(" %s\n", it->c_str()); | 176 printf(" %s\n", it->c_str()); |
| 175 printf("\n"); | 177 printf("\n"); |
| 176 } | 178 } |
| 177 } | 179 } |
| OLD | NEW |