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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_TEST_UTILS_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_TEST_UTILS_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_TEST_UTILS_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_TEST_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 // or not the specified type. | 33 // or not the specified type. |
34 base::Value* ParseJSON(const std::string& data); | 34 base::Value* ParseJSON(const std::string& data); |
35 base::ListValue* ParseList(const std::string& data); | 35 base::ListValue* ParseList(const std::string& data); |
36 | 36 |
37 // If |val| is a dictionary, return it as one, otherwise NULL. | 37 // If |val| is a dictionary, return it as one, otherwise NULL. |
38 base::DictionaryValue* ToDictionary(base::Value* val); | 38 base::DictionaryValue* ToDictionary(base::Value* val); |
39 | 39 |
40 // If |val| is a list, return it as one, otherwise NULL. | 40 // If |val| is a list, return it as one, otherwise NULL. |
41 base::ListValue* ToList(base::Value* val); | 41 base::ListValue* ToList(base::Value* val); |
42 | 42 |
43 // Creates an extension instance with a specified location that can be attached | |
44 // to an ExtensionFunction before running. | |
45 scoped_refptr<extensions::Extension> CreateEmptyExtensionWithLocation( | |
46 extensions::Manifest::Location location); | |
47 | |
48 // Returns true if |val| contains privacy information, e.g. url, | 43 // Returns true if |val| contains privacy information, e.g. url, |
49 // title, and faviconUrl. | 44 // title, and faviconUrl. |
50 bool HasPrivacySensitiveFields(base::DictionaryValue* val); | 45 bool HasPrivacySensitiveFields(base::DictionaryValue* val); |
51 | 46 |
52 enum RunFunctionFlags { | 47 enum RunFunctionFlags { |
53 NONE = 0, | 48 NONE = 0, |
54 INCLUDE_INCOGNITO = 1 << 0 | 49 INCLUDE_INCOGNITO = 1 << 0 |
55 }; | 50 }; |
56 | 51 |
57 // Run |function| with |args| and return the resulting error. Adds an error to | 52 // Run |function| with |args| and return the resulting error. Adds an error to |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 Browser* browser, | 88 Browser* browser, |
94 RunFunctionFlags flags); | 89 RunFunctionFlags flags); |
95 bool RunFunction(UIThreadExtensionFunction* function, | 90 bool RunFunction(UIThreadExtensionFunction* function, |
96 scoped_ptr<base::ListValue> args, | 91 scoped_ptr<base::ListValue> args, |
97 Browser* browser, | 92 Browser* browser, |
98 RunFunctionFlags flags); | 93 RunFunctionFlags flags); |
99 | 94 |
100 } // namespace extension_function_test_utils | 95 } // namespace extension_function_test_utils |
101 | 96 |
102 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_TEST_UTILS_H_ | 97 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_TEST_UTILS_H_ |
OLD | NEW |