| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 // Creates an extension instance that can be attached to an ExtensionFunction | 49 // Creates an extension instance that can be attached to an ExtensionFunction |
| 50 // before running it. | 50 // before running it. |
| 51 scoped_refptr<extensions::Extension> CreateEmptyExtension(); | 51 scoped_refptr<extensions::Extension> CreateEmptyExtension(); |
| 52 | 52 |
| 53 // Creates an extension instance with a specified location that can be attached | 53 // Creates an extension instance with a specified location that can be attached |
| 54 // to an ExtensionFunction before running. | 54 // to an ExtensionFunction before running. |
| 55 scoped_refptr<extensions::Extension> CreateEmptyExtensionWithLocation( | 55 scoped_refptr<extensions::Extension> CreateEmptyExtensionWithLocation( |
| 56 extensions::Extension::Location location); | 56 extensions::Extension::Location location); |
| 57 | 57 |
| 58 // Creates an extension instance with a specified extension value that can be |
| 59 // attached to an ExtensionFunction before running. |
| 60 scoped_refptr<extensions::Extension> CreateEmptyExtensionWithValue( |
| 61 base::DictionaryValue* test_extension_value); |
| 62 |
| 63 scoped_refptr<extensions::Extension> CreateExtension( |
| 64 extensions::Extension::Location location, |
| 65 base::DictionaryValue* test_extension_value); |
| 66 |
| 67 // Returns true if |val| contains privacy information, e.g. url, |
| 68 // title, and faviconUrl. |
| 69 bool HasPrivateInfo(base::DictionaryValue* val); |
| 70 |
| 58 enum RunFunctionFlags { | 71 enum RunFunctionFlags { |
| 59 NONE = 0, | 72 NONE = 0, |
| 60 INCLUDE_INCOGNITO = 1 << 0 | 73 INCLUDE_INCOGNITO = 1 << 0 |
| 61 }; | 74 }; |
| 62 | 75 |
| 63 // Run |function| with |args| and return the resulting error. Adds an error to | 76 // Run |function| with |args| and return the resulting error. Adds an error to |
| 64 // the current test if |function| returns a result. | 77 // the current test if |function| returns a result. |
| 65 std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function, | 78 std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function, |
| 66 const std::string& args, | 79 const std::string& args, |
| 67 Browser* browser, | 80 Browser* browser, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 92 // we're going to need to frob for all the different extension functions. But | 105 // we're going to need to frob for all the different extension functions. But |
| 93 // we can refactor when we see what is needed. | 106 // we can refactor when we see what is needed. |
| 94 bool RunFunction(UIThreadExtensionFunction* function, | 107 bool RunFunction(UIThreadExtensionFunction* function, |
| 95 const std::string& args, | 108 const std::string& args, |
| 96 Browser* browser, | 109 Browser* browser, |
| 97 RunFunctionFlags flags); | 110 RunFunctionFlags flags); |
| 98 | 111 |
| 99 } // namespace extension_function_test_utils | 112 } // namespace extension_function_test_utils |
| 100 | 113 |
| 101 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_TEST_UTILS_H_ | 114 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_TEST_UTILS_H_ |
| OLD | NEW |