| 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 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 content::WebContents* contents() { return contents_; } | 45 content::WebContents* contents() { return contents_; } |
| 46 | 46 |
| 47 const Extension* extension() const { return extension_.get(); } | 47 const Extension* extension() const { return extension_.get(); } |
| 48 scoped_refptr<Extension> extension_ref() { return extension_; } | 48 scoped_refptr<Extension> extension_ref() { return extension_; } |
| 49 void set_extension(scoped_refptr<Extension> extension) { | 49 void set_extension(scoped_refptr<Extension> extension) { |
| 50 extension_ = extension; | 50 extension_ = extension; |
| 51 } | 51 } |
| 52 | 52 |
| 53 protected: | 53 protected: |
| 54 // SetUp creates and loads an empty, unpacked Extension. | 54 // SetUp creates and loads an empty, unpacked Extension. |
| 55 virtual void SetUp() OVERRIDE; | 55 virtual void SetUp() override; |
| 56 | 56 |
| 57 // Creates a background page for |extension_|, and sets it for the WebContents | 57 // Creates a background page for |extension_|, and sets it for the WebContents |
| 58 // to be used in API calls. | 58 // to be used in API calls. |
| 59 // If |contents_| is already set, this does nothing. | 59 // If |contents_| is already set, this does nothing. |
| 60 void CreateBackgroundPage(); | 60 void CreateBackgroundPage(); |
| 61 | 61 |
| 62 // Various ways of running an API function. These methods take ownership of | 62 // Various ways of running an API function. These methods take ownership of |
| 63 // |function|. |args| should be in JSON format, wrapped in a list. | 63 // |function|. |args| should be in JSON format, wrapped in a list. |
| 64 // See also the RunFunction* methods in extension_function_test_utils.h. | 64 // See also the RunFunction* methods in extension_function_test_utils.h. |
| 65 | 65 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 91 // or NULL. | 91 // or NULL. |
| 92 content::WebContents* contents_; | 92 content::WebContents* contents_; |
| 93 | 93 |
| 94 // The Extension used when running API function calls. | 94 // The Extension used when running API function calls. |
| 95 scoped_refptr<Extension> extension_; | 95 scoped_refptr<Extension> extension_; |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 } // namespace extensions | 98 } // namespace extensions |
| 99 | 99 |
| 100 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_API_UNITTEST_H_ | 100 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_API_UNITTEST_H_ |
| OLD | NEW |