OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 10 #include "base/bind.h" |
(...skipping 1453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 base::Unretained(automation_.get()), | 1464 base::Unretained(automation_.get()), |
1465 frame_id.view_id, | 1465 frame_id.view_id, |
1466 frame_id.frame_path, | 1466 frame_id.frame_path, |
1467 script, | 1467 script, |
1468 &response_json, | 1468 &response_json, |
1469 &error)); | 1469 &error)); |
1470 if (error) | 1470 if (error) |
1471 return error; | 1471 return error; |
1472 | 1472 |
1473 scoped_ptr<Value> value(base::JSONReader::ReadAndReturnError( | 1473 scoped_ptr<Value> value(base::JSONReader::ReadAndReturnError( |
1474 response_json, true, NULL, NULL)); | 1474 response_json, base::JSON_ALLOW_TRAILING_COMMAS, NULL, NULL)); |
1475 if (!value.get()) | 1475 if (!value.get()) |
1476 return new Error(kUnknownError, "Failed to parse script result"); | 1476 return new Error(kUnknownError, "Failed to parse script result"); |
1477 if (value->GetType() != Value::TYPE_DICTIONARY) | 1477 if (value->GetType() != Value::TYPE_DICTIONARY) |
1478 return new Error(kUnknownError, "Execute script returned non-dict: " + | 1478 return new Error(kUnknownError, "Execute script returned non-dict: " + |
1479 JsonStringify(value.get())); | 1479 JsonStringify(value.get())); |
1480 DictionaryValue* result_dict = static_cast<DictionaryValue*>(value.get()); | 1480 DictionaryValue* result_dict = static_cast<DictionaryValue*>(value.get()); |
1481 | 1481 |
1482 int status; | 1482 int status; |
1483 if (!result_dict->GetInteger("status", &status)) | 1483 if (!result_dict->GetInteger("status", &status)) |
1484 return new Error(kUnknownError, "Execute script did not return status: " + | 1484 return new Error(kUnknownError, "Execute script did not return status: " + |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1885 capabilities_.local_state->GetWithoutPathExpansion(*iter, &value); | 1885 capabilities_.local_state->GetWithoutPathExpansion(*iter, &value); |
1886 Error* error = SetPreference(*iter, false /* is_user_pref */, | 1886 Error* error = SetPreference(*iter, false /* is_user_pref */, |
1887 value->DeepCopy()); | 1887 value->DeepCopy()); |
1888 if (error) | 1888 if (error) |
1889 return error; | 1889 return error; |
1890 } | 1890 } |
1891 return NULL; | 1891 return NULL; |
1892 } | 1892 } |
1893 | 1893 |
1894 } // namespace webdriver | 1894 } // namespace webdriver |
OLD | NEW |