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