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; | |
53 | 52 |
54 // Creates a background page for |extension_|, and sets it for the WebContents | 53 // Creates a background page for |extension_|, and sets it for the WebContents |
55 // to be used in API calls. | 54 // to be used in API calls. |
56 // If |contents_| is already set, this does nothing. | 55 // If |contents_| is already set, this does nothing. |
57 void CreateBackgroundPage(); | 56 void CreateBackgroundPage(); |
58 | 57 |
59 // Various ways of running an API function. These methods take ownership of | 58 // Various ways of running an API function. These methods take ownership of |
60 // |function|. |args| should be in JSON format, wrapped in a list. | 59 // |function|. |args| should be in JSON format, wrapped in a list. |
61 // See also the RunFunction* methods in extension_function_test_utils.h. | 60 // See also the RunFunction* methods in extension_function_test_utils.h. |
62 | 61 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 // or null. | 95 // or null. |
97 scoped_ptr<content::WebContents> contents_; | 96 scoped_ptr<content::WebContents> contents_; |
98 | 97 |
99 // The Extension used when running API function calls. | 98 // The Extension used when running API function calls. |
100 scoped_refptr<Extension> extension_; | 99 scoped_refptr<Extension> extension_; |
101 }; | 100 }; |
102 | 101 |
103 } // namespace extensions | 102 } // namespace extensions |
104 | 103 |
105 #endif // EXTENSIONS_BROWSER_API_UNITTEST_H_ | 104 #endif // EXTENSIONS_BROWSER_API_UNITTEST_H_ |
OLD | NEW |