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

Side by Side Diff: chrome/browser/extensions/extension_api_unittest.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: content_plugin Created 6 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 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 CHROME_BROWSER_EXTENSIONS_EXTENSION_API_UNITTEST_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_API_UNITTEST_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_API_UNITTEST_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_API_UNITTEST_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 17 matching lines...) Expand all
28 // Use this class to enable calling API functions in a unittest. 28 // Use this class to enable calling API functions in a unittest.
29 // By default, this class will create and load an empty unpacked |extension_|, 29 // By default, this class will create and load an empty unpacked |extension_|,
30 // which will be used in all API function calls. This extension can be 30 // which will be used in all API function calls. This extension can be
31 // overridden using set_extension(). 31 // overridden using set_extension().
32 // By default, this class does not create a WebContents for the API functions. 32 // By default, this class does not create a WebContents for the API functions.
33 // If a WebContents is needed, calling CreateBackgroundPage() will create a 33 // If a WebContents is needed, calling CreateBackgroundPage() will create a
34 // background page for the extension and use it in API function calls. (If 34 // background page for the extension and use it in API function calls. (If
35 // needed, this could be expanded to allow for alternate WebContents). 35 // needed, this could be expanded to allow for alternate WebContents).
36 // When calling RunFunction[AndReturn*], |args| should be in JSON format, 36 // When calling RunFunction[AndReturn*], |args| should be in JSON format,
37 // wrapped in a list. See also RunFunction* in extension_function_test_utils.h. 37 // wrapped in a list. See also RunFunction* in extension_function_test_utils.h.
38 // TODO(yoz): Move users of this base class to use the equivalent base class
39 // in extensions/browser/api_unittest.h.
38 class ExtensionApiUnittest : public BrowserWithTestWindowTest { 40 class ExtensionApiUnittest : public BrowserWithTestWindowTest {
39 public: 41 public:
40 ExtensionApiUnittest(); 42 ExtensionApiUnittest();
41 virtual ~ExtensionApiUnittest(); 43 virtual ~ExtensionApiUnittest();
42 44
43 content::WebContents* contents() { return contents_; } 45 content::WebContents* contents() { return contents_; }
44 46
45 const Extension* extension() const { return extension_.get(); } 47 const Extension* extension() const { return extension_.get(); }
46 scoped_refptr<Extension> extension_ref() { return extension_; } 48 scoped_refptr<Extension> extension_ref() { return extension_; }
47 void set_extension(scoped_refptr<Extension> extension) { 49 void set_extension(scoped_refptr<Extension> extension) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 // or NULL. 91 // or NULL.
90 content::WebContents* contents_; 92 content::WebContents* contents_;
91 93
92 // The Extension used when running API function calls. 94 // The Extension used when running API function calls.
93 scoped_refptr<Extension> extension_; 95 scoped_refptr<Extension> extension_;
94 }; 96 };
95 97
96 } // namespace extensions 98 } // namespace extensions
97 99
98 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_API_UNITTEST_H_ 100 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_API_UNITTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698