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