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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/string_split.h" | 10 #include "base/string_split.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 return false; | 168 return false; |
169 | 169 |
170 std::string json = WideToUTF8(json_wide); | 170 std::string json = WideToUTF8(json_wide); |
171 JSONStringValueSerializer deserializer(json); | 171 JSONStringValueSerializer deserializer(json); |
172 scoped_ptr<Value> value(deserializer.Deserialize(NULL, NULL)); | 172 scoped_ptr<Value> value(deserializer.Deserialize(NULL, NULL)); |
173 | 173 |
174 EXPECT_TRUE(value.get()); | 174 EXPECT_TRUE(value.get()); |
175 if (!value.get()) | 175 if (!value.get()) |
176 return false; | 176 return false; |
177 | 177 |
178 EXPECT_TRUE(value->AsList()); | 178 EXPECT_TRUE(value->IsType(Value::TYPE_LIST)); |
179 ListValue* list_value = value->AsList(); | 179 if (!value->IsType(Value::TYPE_LIST)) |
180 if (!list_value) | |
181 return false; | 180 return false; |
182 | 181 |
| 182 ListValue* list_value = static_cast<ListValue*>(value.get()); |
| 183 |
183 // The parsed JSON object will be an array of strings, each of which is a | 184 // The parsed JSON object will be an array of strings, each of which is a |
184 // test failure. Add those strings to the results set. | 185 // test failure. Add those strings to the results set. |
185 ListValue::const_iterator it = list_value->begin(); | 186 ListValue::const_iterator it = list_value->begin(); |
186 for (; it != list_value->end(); ++it) { | 187 for (; it != list_value->end(); ++it) { |
187 EXPECT_TRUE((*it)->IsType(Value::TYPE_STRING)); | 188 EXPECT_TRUE((*it)->IsType(Value::TYPE_STRING)); |
188 if ((*it)->IsType(Value::TYPE_STRING)) { | 189 if ((*it)->IsType(Value::TYPE_STRING)) { |
189 std::string test_name; | 190 std::string test_name; |
190 succeeded = (*it)->GetAsString(&test_name); | 191 succeeded = (*it)->GetAsString(&test_name); |
191 EXPECT_TRUE(succeeded); | 192 EXPECT_TRUE(succeeded); |
192 if (succeeded) | 193 if (succeeded) |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 TEST_F(DomCheckerTest, FAILS_Http) { | 245 TEST_F(DomCheckerTest, FAILS_Http) { |
245 if (!CommandLine::ForCurrentProcess()->HasSwitch(kRunDomCheckerTest)) | 246 if (!CommandLine::ForCurrentProcess()->HasSwitch(kRunDomCheckerTest)) |
246 return; | 247 return; |
247 | 248 |
248 ResultsList new_passes, new_failures; | 249 ResultsList new_passes, new_failures; |
249 RunTest(true, &new_passes, &new_failures); | 250 RunTest(true, &new_passes, &new_failures); |
250 PrintResults(new_passes, new_failures); | 251 PrintResults(new_passes, new_failures); |
251 } | 252 } |
252 | 253 |
253 } // namespace | 254 } // namespace |
OLD | NEW |