OLD | NEW |
1 // Copyright (c) 2011 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. |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 scoped_refptr<TabProxy> tab(GetActiveTab()); | 111 scoped_refptr<TabProxy> tab(GetActiveTab()); |
112 tab->NavigateToURL(test_url); | 112 tab->NavigateToURL(test_url); |
113 | 113 |
114 // Wait for the test to finish. | 114 // Wait for the test to finish. |
115 ASSERT_TRUE(WaitUntilCookieValue( | 115 ASSERT_TRUE(WaitUntilCookieValue( |
116 tab.get(), test_url, "__tests_finished", | 116 tab.get(), test_url, "__tests_finished", |
117 TestTimeouts::huge_test_timeout_ms(), "1")); | 117 TestTimeouts::huge_test_timeout_ms(), "1")); |
118 | 118 |
119 std::string cookie; | 119 std::string cookie; |
120 ASSERT_TRUE(tab->GetCookieByName(test_url, "__num_tests_total", &cookie)); | 120 ASSERT_TRUE(tab->GetCookieByName(test_url, "__num_tests_total", &cookie)); |
121 total->swap(UTF8ToWide(cookie)); | 121 *total = UTF8ToWide(cookie); |
122 ASSERT_FALSE(total->empty()); | 122 ASSERT_FALSE(total->empty()); |
123 ASSERT_TRUE(tab->GetCookieByName(test_url, "__tests_failed", &cookie)); | 123 ASSERT_TRUE(tab->GetCookieByName(test_url, "__tests_failed", &cookie)); |
124 failed->swap(UTF8ToWide(cookie)); | 124 *failed = UTF8ToWide(cookie); |
125 // 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. |
126 #endif | 126 #endif |
127 } | 127 } |
128 | 128 |
129 void RunTest(ResultsList* new_passes_list, ResultsList* new_failures_list) { | 129 void RunTest(ResultsList* new_passes_list, ResultsList* new_failures_list) { |
130 std::string expected_failures; | 130 std::string expected_failures; |
131 bool have_expected_results = ReadExpectedResults(&expected_failures); | 131 bool have_expected_results = ReadExpectedResults(&expected_failures); |
132 ASSERT_TRUE(have_expected_results); | 132 ASSERT_TRUE(have_expected_results); |
133 | 133 |
134 std::wstring total, failed; | 134 std::wstring total, failed; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 } | 170 } |
171 | 171 |
172 if (!new_passes_list.empty()) { | 172 if (!new_passes_list.empty()) { |
173 printf("new tests passing:\n"); | 173 printf("new tests passing:\n"); |
174 ResultsList::const_iterator it = new_passes_list.begin(); | 174 ResultsList::const_iterator it = new_passes_list.begin(); |
175 for (; it != new_passes_list.end(); ++it) | 175 for (; it != new_passes_list.end(); ++it) |
176 printf(" %s\n", it->c_str()); | 176 printf(" %s\n", it->c_str()); |
177 printf("\n"); | 177 printf("\n"); |
178 } | 178 } |
179 } | 179 } |
OLD | NEW |