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

Side by Side Diff: extensions/browser/api_test_utils.h

Issue 461273003: Rework ExtensionApiUnittest to run in extensions_unittests, removing its Chrome dependencies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jamescook Created 6 years, 4 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 EXTENSIONS_BROWSER_API_TEST_UTILS_H_ 5 #ifndef EXTENSIONS_BROWSER_API_TEST_UTILS_H_
6 #define EXTENSIONS_BROWSER_API_TEST_UTILS_H_ 6 #define EXTENSIONS_BROWSER_API_TEST_UTILS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 base::Value* RunFunctionAndReturnSingleResult( 48 base::Value* RunFunctionAndReturnSingleResult(
49 UIThreadExtensionFunction* function, 49 UIThreadExtensionFunction* function,
50 const std::string& args, 50 const std::string& args,
51 content::BrowserContext* context); 51 content::BrowserContext* context);
52 base::Value* RunFunctionAndReturnSingleResult( 52 base::Value* RunFunctionAndReturnSingleResult(
53 UIThreadExtensionFunction* function, 53 UIThreadExtensionFunction* function,
54 const std::string& args, 54 const std::string& args,
55 content::BrowserContext* context, 55 content::BrowserContext* context,
56 RunFunctionFlags flags); 56 RunFunctionFlags flags);
57 57
58 // Run |function| with |args| and return the resulting error. Adds an error to
59 // the current test if |function| returns a result. Takes ownership of
60 // |function|.
61 std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function,
62 const std::string& args,
63 content::BrowserContext* context,
64 RunFunctionFlags flags);
65 std::string RunFunctionAndReturnError(UIThreadExtensionFunction* function,
66 const std::string& args,
67 content::BrowserContext* context);
68
58 // Create and run |function| with |args|. Works with both synchronous and async 69 // Create and run |function| with |args|. Works with both synchronous and async
59 // functions. Ownership of |function| remains with the caller. 70 // functions. Ownership of |function| remains with the caller.
60 // 71 //
61 // TODO(aa): It would be nice if |args| could be validated against the schema 72 // TODO(aa): It would be nice if |args| could be validated against the schema
62 // that |function| expects. That way, we know that we are testing something 73 // that |function| expects. That way, we know that we are testing something
63 // close to what the bindings would actually send. 74 // close to what the bindings would actually send.
64 // 75 //
65 // TODO(aa): I'm concerned that this style won't scale to all the bits and bobs 76 // TODO(aa): I'm concerned that this style won't scale to all the bits and bobs
66 // we're going to need to frob for all the different extension functions. But 77 // we're going to need to frob for all the different extension functions. But
67 // we can refactor when we see what is needed. 78 // we can refactor when we see what is needed.
68 bool RunFunction(UIThreadExtensionFunction* function, 79 bool RunFunction(UIThreadExtensionFunction* function,
69 const std::string& args, 80 const std::string& args,
70 content::BrowserContext* context, 81 content::BrowserContext* context,
71 scoped_ptr<ExtensionFunctionDispatcher> dispatcher, 82 scoped_ptr<ExtensionFunctionDispatcher> dispatcher,
72 RunFunctionFlags flags); 83 RunFunctionFlags flags);
73 84
74 } // namespace function_test_utils 85 } // namespace function_test_utils
75 } // namespace extensions 86 } // namespace extensions
76 87
77 #endif // EXTENSIONS_BROWSER_API_TEST_UTILS_H_ 88 #endif // EXTENSIONS_BROWSER_API_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698