| 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 #ifndef CHROME_TEST_WEBDRIVER_WEBDRIVER_UTIL_H_ | 5 #ifndef CHROME_TEST_WEBDRIVER_WEBDRIVER_UTIL_H_ |
| 6 #define CHROME_TEST_WEBDRIVER_WEBDRIVER_UTIL_H_ | 6 #define CHROME_TEST_WEBDRIVER_WEBDRIVER_UTIL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/test/automation/value_conversion_traits.h" | 15 #include "chrome/test/automation/value_conversion_traits.h" |
| 16 | 16 |
| 17 class AutomationId; |
| 17 class FilePath; | 18 class FilePath; |
| 19 class WebViewId; |
| 18 | 20 |
| 19 namespace webdriver { | 21 namespace webdriver { |
| 20 | 22 |
| 21 // Generates a random, 32-character hexidecimal ID. | 23 // Generates a random, 32-character hexidecimal ID. |
| 22 std::string GenerateRandomID(); | 24 std::string GenerateRandomID(); |
| 23 | 25 |
| 24 // Returns the equivalent JSON string for the given value. | 26 // Returns the equivalent JSON string for the given value. |
| 25 std::string JsonStringify(const base::Value* value); | 27 std::string JsonStringify(const base::Value* value); |
| 26 | 28 |
| 27 // Returns the JSON string for the given value, with the exception that | 29 // Returns the JSON string for the given value, with the exception that |
| 28 // long strings are shortened for easier display. | 30 // long strings are shortened for easier display. |
| 29 std::string JsonStringifyForDisplay(const base::Value* value); | 31 std::string JsonStringifyForDisplay(const base::Value* value); |
| 30 | 32 |
| 31 // Returns the string representation of the given type, for display purposes. | 33 // Returns the string representation of the given type, for display purposes. |
| 32 const char* GetJsonTypeName(base::Value::Type type); | 34 const char* GetJsonTypeName(base::Value::Type type); |
| 33 | 35 |
| 36 // Converts the string to an automation ID and returns true on success. |
| 37 bool StringToAutomationId(const std::string& string_id, AutomationId* id); |
| 38 |
| 39 // Converts the web view ID to a string. |
| 40 std::string WebViewIdToString(const WebViewId& view_id); |
| 41 |
| 42 // Converts the string to a web view ID and returns true on success. |
| 43 bool StringToWebViewId(const std::string& string_id, WebViewId* view_id); |
| 44 |
| 34 #if defined(OS_MACOSX) | 45 #if defined(OS_MACOSX) |
| 35 // Gets the paths to the user and local application directory. | 46 // Gets the paths to the user and local application directory. |
| 36 void GetApplicationDirs(std::vector<FilePath>* app_dirs); | 47 void GetApplicationDirs(std::vector<FilePath>* app_dirs); |
| 37 #endif | 48 #endif |
| 38 | 49 |
| 39 // Parses a given value. | 50 // Parses a given value. |
| 40 class ValueParser { | 51 class ValueParser { |
| 41 public: | 52 public: |
| 42 virtual ~ValueParser(); | 53 virtual ~ValueParser(); |
| 43 virtual bool Parse(base::Value* value) const = 0; | 54 virtual bool Parse(base::Value* value) const = 0; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 | 94 |
| 84 // Value conversion traits for SkipParsing, which just return true. | 95 // Value conversion traits for SkipParsing, which just return true. |
| 85 template <> | 96 template <> |
| 86 struct ValueConversionTraits<webdriver::SkipParsing> { | 97 struct ValueConversionTraits<webdriver::SkipParsing> { |
| 87 static bool SetFromValue(const base::Value* value, | 98 static bool SetFromValue(const base::Value* value, |
| 88 const webdriver::SkipParsing* t); | 99 const webdriver::SkipParsing* t); |
| 89 static bool CanConvert(const base::Value* value); | 100 static bool CanConvert(const base::Value* value); |
| 90 }; | 101 }; |
| 91 | 102 |
| 92 #endif // CHROME_TEST_WEBDRIVER_WEBDRIVER_UTIL_H_ | 103 #endif // CHROME_TEST_WEBDRIVER_WEBDRIVER_UTIL_H_ |
| OLD | NEW |