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 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/scoped_ptr.h" | 9 #include "base/scoped_ptr.h" |
10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 return true; | 142 return true; |
143 } | 143 } |
144 | 144 |
145 bool WaitUntilTestCompletes(TabProxy* tab) { | 145 bool WaitUntilTestCompletes(TabProxy* tab) { |
146 return WaitUntilJavaScriptCondition(tab, L"", | 146 return WaitUntilJavaScriptCondition(tab, L"", |
147 L"window.domAutomationController.send(automation.IsDone());", | 147 L"window.domAutomationController.send(automation.IsDone());", |
148 TestTimeouts::huge_test_timeout_ms()); | 148 TestTimeouts::huge_test_timeout_ms()); |
149 } | 149 } |
150 | 150 |
151 bool GetTestCount(TabProxy* tab, int* test_count) { | 151 bool GetTestCount(TabProxy* tab, int* test_count) { |
152 return tab->ExecuteAndExtractInt(L"", | 152 return tab->ExecuteAndExtractInt(string16(), |
153 L"window.domAutomationController.send(automation.GetTestCount());", | 153 ASCIIToUTF16("window.domAutomationController.send(" |
| 154 "automation.GetTestCount());"), |
154 test_count); | 155 test_count); |
155 } | 156 } |
156 | 157 |
157 bool GetTestsFailed(TabProxy* tab, ResultsSet* tests_failed) { | 158 bool GetTestsFailed(TabProxy* tab, ResultsSet* tests_failed) { |
158 std::wstring json_wide; | 159 string16 json16; |
159 bool succeeded = tab->ExecuteAndExtractString(L"", | 160 bool succeeded = tab->ExecuteAndExtractString(string16(), |
160 L"window.domAutomationController.send(" | 161 ASCIIToUTF16("window.domAutomationController.send(" |
161 L" JSON.stringify(automation.GetFailures()));", | 162 "JSON.stringify(automation.GetFailures()));"), |
162 &json_wide); | 163 &json16); |
163 | 164 |
164 // Note that we don't use ASSERT_TRUE here (and in some other places) as it | 165 // Note that we don't use ASSERT_TRUE here (and in some other places) as it |
165 // doesn't work inside a function with a return type other than void. | 166 // doesn't work inside a function with a return type other than void. |
166 EXPECT_TRUE(succeeded); | 167 EXPECT_TRUE(succeeded); |
167 if (!succeeded) | 168 if (!succeeded) |
168 return false; | 169 return false; |
169 | 170 |
170 std::string json = WideToUTF8(json_wide); | 171 std::string json = UTF16ToUTF8(json16); |
171 JSONStringValueSerializer deserializer(json); | 172 JSONStringValueSerializer deserializer(json); |
172 scoped_ptr<Value> value(deserializer.Deserialize(NULL, NULL)); | 173 scoped_ptr<Value> value(deserializer.Deserialize(NULL, NULL)); |
173 | 174 |
174 EXPECT_TRUE(value.get()); | 175 EXPECT_TRUE(value.get()); |
175 if (!value.get()) | 176 if (!value.get()) |
176 return false; | 177 return false; |
177 | 178 |
178 EXPECT_TRUE(value->IsType(Value::TYPE_LIST)); | 179 EXPECT_TRUE(value->IsType(Value::TYPE_LIST)); |
179 if (!value->IsType(Value::TYPE_LIST)) | 180 if (!value->IsType(Value::TYPE_LIST)) |
180 return false; | 181 return false; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 TEST_F(DomCheckerTest, FAILS_Http) { | 246 TEST_F(DomCheckerTest, FAILS_Http) { |
246 if (!CommandLine::ForCurrentProcess()->HasSwitch(kRunDomCheckerTest)) | 247 if (!CommandLine::ForCurrentProcess()->HasSwitch(kRunDomCheckerTest)) |
247 return; | 248 return; |
248 | 249 |
249 ResultsList new_passes, new_failures; | 250 ResultsList new_passes, new_failures; |
250 RunTest(true, &new_passes, &new_failures); | 251 RunTest(true, &new_passes, &new_failures); |
251 PrintResults(new_passes, new_failures); | 252 PrintResults(new_passes, new_failures); |
252 } | 253 } |
253 | 254 |
254 } // namespace | 255 } // namespace |
OLD | NEW |