OLD | NEW |
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_UNITTEST_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_UNITTEST_H_ |
6 #define EXTENSIONS_BROWSER_API_UNITTEST_H_ | 6 #define EXTENSIONS_BROWSER_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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 content::WebContents* contents() { return contents_.get(); } | 42 content::WebContents* contents() { return contents_.get(); } |
43 const Extension* extension() const { return extension_.get(); } | 43 const Extension* extension() const { return extension_.get(); } |
44 scoped_refptr<Extension> extension_ref() { return extension_; } | 44 scoped_refptr<Extension> extension_ref() { return extension_; } |
45 void set_extension(scoped_refptr<Extension> extension) { | 45 void set_extension(scoped_refptr<Extension> extension) { |
46 extension_ = extension; | 46 extension_ = extension; |
47 } | 47 } |
48 | 48 |
49 protected: | 49 protected: |
50 // SetUp creates and loads an empty, unpacked Extension. | 50 // SetUp creates and loads an empty, unpacked Extension. |
51 void SetUp() override; | 51 void SetUp() override; |
| 52 void TearDown() override; |
52 | 53 |
53 // Creates a background page for |extension_|, and sets it for the WebContents | 54 // Creates a background page for |extension_|, and sets it for the WebContents |
54 // to be used in API calls. | 55 // to be used in API calls. |
55 // If |contents_| is already set, this does nothing. | 56 // If |contents_| is already set, this does nothing. |
56 void CreateBackgroundPage(); | 57 void CreateBackgroundPage(); |
57 | 58 |
58 // Various ways of running an API function. These methods take ownership of | 59 // Various ways of running an API function. These methods take ownership of |
59 // |function|. |args| should be in JSON format, wrapped in a list. | 60 // |function|. |args| should be in JSON format, wrapped in a list. |
60 // See also the RunFunction* methods in extension_function_test_utils.h. | 61 // See also the RunFunction* methods in extension_function_test_utils.h. |
61 | 62 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // or null. | 96 // or null. |
96 scoped_ptr<content::WebContents> contents_; | 97 scoped_ptr<content::WebContents> contents_; |
97 | 98 |
98 // The Extension used when running API function calls. | 99 // The Extension used when running API function calls. |
99 scoped_refptr<Extension> extension_; | 100 scoped_refptr<Extension> extension_; |
100 }; | 101 }; |
101 | 102 |
102 } // namespace extensions | 103 } // namespace extensions |
103 | 104 |
104 #endif // EXTENSIONS_BROWSER_API_UNITTEST_H_ | 105 #endif // EXTENSIONS_BROWSER_API_UNITTEST_H_ |
OLD | NEW |