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 "chrome/test/webdriver/webdriver_session.h" | 5 #include "chrome/test/webdriver/webdriver_session.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 CHECK(root_element.is_valid()); | 1233 CHECK(root_element.is_valid()); |
1234 | 1234 |
1235 class FindElementsParser : public ValueParser { | 1235 class FindElementsParser : public ValueParser { |
1236 public: | 1236 public: |
1237 explicit FindElementsParser(std::vector<ElementId>* elements) | 1237 explicit FindElementsParser(std::vector<ElementId>* elements) |
1238 : elements_(elements) { } | 1238 : elements_(elements) { } |
1239 | 1239 |
1240 virtual ~FindElementsParser() { } | 1240 virtual ~FindElementsParser() { } |
1241 | 1241 |
1242 virtual bool Parse(base::Value* value) const OVERRIDE { | 1242 virtual bool Parse(base::Value* value) const OVERRIDE { |
1243 ListValue* list = value->AsList(); | 1243 if (!value->IsType(Value::TYPE_LIST)) |
1244 if (!list) | |
1245 return false; | 1244 return false; |
| 1245 ListValue* list = static_cast<ListValue*>(value); |
1246 for (size_t i = 0; i < list->GetSize(); ++i) { | 1246 for (size_t i = 0; i < list->GetSize(); ++i) { |
1247 ElementId element; | 1247 ElementId element; |
1248 Value* element_value = NULL; | 1248 Value* element_value = NULL; |
1249 if (!list->Get(i, &element_value)) | 1249 if (!list->Get(i, &element_value)) |
1250 return false; | 1250 return false; |
1251 if (!SetFromValue(element_value, &element)) | 1251 if (!SetFromValue(element_value, &element)) |
1252 return false; | 1252 return false; |
1253 elements_->push_back(element); | 1253 elements_->push_back(element); |
1254 } | 1254 } |
1255 return true; | 1255 return true; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1408 Error* Session::GetAppCacheStatus(int* status) { | 1408 Error* Session::GetAppCacheStatus(int* status) { |
1409 return ExecuteScriptAndParse( | 1409 return ExecuteScriptAndParse( |
1410 current_target_, | 1410 current_target_, |
1411 atoms::asString(atoms::GET_APPCACHE_STATUS), | 1411 atoms::asString(atoms::GET_APPCACHE_STATUS), |
1412 "getAppcacheStatus", | 1412 "getAppcacheStatus", |
1413 new ListValue(), | 1413 new ListValue(), |
1414 CreateDirectValueParser(status)); | 1414 CreateDirectValueParser(status)); |
1415 } | 1415 } |
1416 | 1416 |
1417 } // namespace webdriver | 1417 } // namespace webdriver |
OLD | NEW |