Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: chrome/browser/extensions/extension_function_test_utils.h

Issue 10919201: Make sure that a given app/extension requests only its own resources. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 empty extension with a variable ID, for tests that require
58 // multiple extensions side-by-side having distinct IDs. If not empty, then
59 // id_input is passed directly to Extension::CreateId() and thus has the same
60 // behavior as that method. If id_input is empty, then Extension::Create()
61 // receives an empty explicit ID and generates an appropriate ID for a blank
62 // extension.
63 scoped_refptr<extensions::Extension> CreateEmptyExtension(
64 extensions::Extension::Location location,
65 const std::string& id_input);
66
57 enum RunFunctionFlags { 67 enum RunFunctionFlags {
58 NONE = 0, 68 NONE = 0,
59 INCLUDE_INCOGNITO = 1 << 0 69 INCLUDE_INCOGNITO = 1 << 0
60 }; 70 };
61 71
62 // Run |function| with |args| and return the resulting error. Adds an error to 72 // Run |function| with |args| and return the resulting error. Adds an error to
63 // the current test if |function| returns a result. 73 // the current test if |function| returns a result.
64 std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function, 74 std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function,
65 const std::string& args, 75 const std::string& args,
66 Browser* browser, 76 Browser* browser,
(...skipping 26 matching lines...) Expand all
93 // we're going to need to frob for all the different extension functions. But 103 // we're going to need to frob for all the different extension functions. But
94 // we can refactor when we see what is needed. 104 // we can refactor when we see what is needed.
95 bool RunFunction(UIThreadExtensionFunction* function, 105 bool RunFunction(UIThreadExtensionFunction* function,
96 const std::string& args, 106 const std::string& args,
97 Browser* browser, 107 Browser* browser,
98 RunFunctionFlags flags); 108 RunFunctionFlags flags);
99 109
100 } // namespace extension_function_test_utils 110 } // namespace extension_function_test_utils
101 111
102 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_TEST_UTILS_H_ 112 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_FUNCTION_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698