| OLD | NEW |
| 1 // Copyright (c) 2010 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 #ifndef CHROME_TEST_WEBDRIVER_UTILITY_FUNCTIONS_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_UTILITY_FUNCTIONS_H_ |
| 6 #define CHROME_TEST_WEBDRIVER_UTILITY_FUNCTIONS_H_ | 6 #define CHROME_TEST_WEBDRIVER_UTILITY_FUNCTIONS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/values.h" | |
| 11 | |
| 12 namespace webdriver { | 10 namespace webdriver { |
| 13 | 11 |
| 14 // Converts a value type to a string for logging. | |
| 15 std::string print_valuetype(Value::ValueType e); | |
| 16 | |
| 17 // Checks that a value has the expected type. | |
| 18 void CheckValueType(const Value::ValueType expected, const Value* const actual); | |
| 19 | |
| 20 // Attempts to parse a |json| string into a valid dictionary. If the parse | |
| 21 // operation fails, the offending |error| will be reported to the user and the | |
| 22 // function will return false. The caller is responsible for the allocated | |
| 23 // memory in |dict|. | |
| 24 bool ParseJSONDictionary(const std::string& json, DictionaryValue** dict, | |
| 25 std::string* error); | |
| 26 | |
| 27 // Generates a random, 32-character hexidecimal ID. | 12 // Generates a random, 32-character hexidecimal ID. |
| 28 std::string GenerateRandomID(); | 13 std::string GenerateRandomID(); |
| 29 | 14 |
| 30 } // namespace webdriver | 15 } // namespace webdriver |
| 31 | 16 |
| 32 #endif // CHROME_TEST_WEBDRIVER_UTILITY_FUNCTIONS_H_ | 17 #endif // CHROME_TEST_WEBDRIVER_UTILITY_FUNCTIONS_H_ |
| OLD | NEW |