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 "chrome/test/automation/value_conversion_traits.h" | 15 #include "chrome/test/automation/value_conversion_traits.h" |
15 | 16 |
16 class FilePath; | 17 class FilePath; |
17 | 18 |
18 namespace base { | |
19 class Value; | |
20 } | |
21 | |
22 namespace webdriver { | 19 namespace webdriver { |
23 | 20 |
24 // Generates a random, 32-character hexidecimal ID. | 21 // Generates a random, 32-character hexidecimal ID. |
25 std::string GenerateRandomID(); | 22 std::string GenerateRandomID(); |
26 | 23 |
27 // Returns the equivalent JSON string for the given value. | 24 // Returns the equivalent JSON string for the given value. |
28 std::string JsonStringify(const base::Value* value); | 25 std::string JsonStringify(const base::Value* value); |
29 | 26 |
| 27 // Returns the string representation of the given type, for display purposes. |
| 28 const char* GetJsonTypeName(base::Value::Type type); |
| 29 |
30 #if defined(OS_MACOSX) | 30 #if defined(OS_MACOSX) |
31 // Gets the paths to the user and local application directory. | 31 // Gets the paths to the user and local application directory. |
32 void GetApplicationDirs(std::vector<FilePath>* app_dirs); | 32 void GetApplicationDirs(std::vector<FilePath>* app_dirs); |
33 #endif | 33 #endif |
34 | 34 |
35 // Parses a given value. | 35 // Parses a given value. |
36 class ValueParser { | 36 class ValueParser { |
37 public: | 37 public: |
38 virtual ~ValueParser(); | 38 virtual ~ValueParser(); |
39 virtual bool Parse(base::Value* value) const = 0; | 39 virtual bool Parse(base::Value* value) const = 0; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 79 |
80 // Value conversion traits for SkipParsing, which just return true. | 80 // Value conversion traits for SkipParsing, which just return true. |
81 template <> | 81 template <> |
82 struct ValueConversionTraits<webdriver::SkipParsing> { | 82 struct ValueConversionTraits<webdriver::SkipParsing> { |
83 static bool SetFromValue(const base::Value* value, | 83 static bool SetFromValue(const base::Value* value, |
84 const webdriver::SkipParsing* t); | 84 const webdriver::SkipParsing* t); |
85 static bool CanConvert(const base::Value* value); | 85 static bool CanConvert(const base::Value* value); |
86 }; | 86 }; |
87 | 87 |
88 #endif // CHROME_TEST_WEBDRIVER_WEBDRIVER_UTIL_H_ | 88 #endif // CHROME_TEST_WEBDRIVER_WEBDRIVER_UTIL_H_ |
OLD | NEW |