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

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

Issue 394103004: Move DnsApiTest.DnsResolveIPLiteral and DnsApiTest.DnsResolveHostname to app_shell_browsertests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 5 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef EXTENSIONS_BROWSER_API_TEST_UTILS_H_
6 #define EXTENSIONS_BROWSER_API_TEST_UTILS_H_
7
8 #include <string>
9
10 #include "base/memory/scoped_ptr.h"
11
12 class UIThreadExtensionFunction;
13
14 namespace base {
15 class Value;
16 }
17
18 namespace content {
19 class BrowserContext;
20 }
21
22 namespace extensions {
23 class ExtensionFunctionDispatcher;
24
25 // TODO(yoz): crbug.com/394840: Remove duplicate functionality in
26 // chrome/browser/extensions/extension_function_test_utils.h.
27 namespace api_test_utils {
28
29 enum RunFunctionFlags { NONE = 0, INCLUDE_INCOGNITO = 1 << 0 };
30
31 // Run |function| with |args| and return the result. Adds an error to the
32 // current test if |function| returns an error. Takes ownership of
33 // |function|. The caller takes ownership of the result.
34 base::Value* RunFunctionAndReturnSingleResult(
35 UIThreadExtensionFunction* function,
36 const std::string& args,
37 content::BrowserContext* context,
38 scoped_ptr<ExtensionFunctionDispatcher> dispatcher);
39 base::Value* RunFunctionAndReturnSingleResult(
40 UIThreadExtensionFunction* function,
41 const std::string& args,
42 content::BrowserContext* context,
43 scoped_ptr<ExtensionFunctionDispatcher> dispatcher,
44 RunFunctionFlags flags);
45
46 // Create and run |function| with |args|. Works with both synchronous and async
47 // functions. Ownership of |function| remains with the caller.
48 //
49 // TODO(aa): It would be nice if |args| could be validated against the schema
50 // that |function| expects. That way, we know that we are testing something
51 // close to what the bindings would actually send.
52 //
53 // TODO(aa): I'm concerned that this style won't scale to all the bits and bobs
54 // we're going to need to frob for all the different extension functions. But
55 // we can refactor when we see what is needed.
56 bool RunFunction(UIThreadExtensionFunction* function,
57 const std::string& args,
58 content::BrowserContext* context,
59 scoped_ptr<ExtensionFunctionDispatcher> dispatcher,
60 RunFunctionFlags flags);
61
62 } // namespace function_test_utils
63 } // namespace extensions
64
65 #endif // EXTENSIONS_BROWSER_API_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698