| 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 29 matching lines...) Expand all Loading... |
| 40 virtual ~ApiUnitTest(); | 40 virtual ~ApiUnitTest(); |
| 41 | 41 |
| 42 const Extension* extension() const { return extension_.get(); } | 42 const Extension* extension() const { return extension_.get(); } |
| 43 scoped_refptr<Extension> extension_ref() { return extension_; } | 43 scoped_refptr<Extension> extension_ref() { return extension_; } |
| 44 void set_extension(scoped_refptr<Extension> extension) { | 44 void set_extension(scoped_refptr<Extension> extension) { |
| 45 extension_ = extension; | 45 extension_ = extension; |
| 46 } | 46 } |
| 47 | 47 |
| 48 protected: | 48 protected: |
| 49 // SetUp creates and loads an empty, unpacked Extension. | 49 // SetUp creates and loads an empty, unpacked Extension. |
| 50 virtual void SetUp() OVERRIDE; | 50 virtual void SetUp() override; |
| 51 | 51 |
| 52 // Various ways of running an API function. These methods take ownership of | 52 // Various ways of running an API function. These methods take ownership of |
| 53 // |function|. |args| should be in JSON format, wrapped in a list. | 53 // |function|. |args| should be in JSON format, wrapped in a list. |
| 54 // See also the RunFunction* methods in extension_function_test_utils.h. | 54 // See also the RunFunction* methods in extension_function_test_utils.h. |
| 55 | 55 |
| 56 // Return the function result as a base::Value. | 56 // Return the function result as a base::Value. |
| 57 scoped_ptr<base::Value> RunFunctionAndReturnValue( | 57 scoped_ptr<base::Value> RunFunctionAndReturnValue( |
| 58 UIThreadExtensionFunction* function, | 58 UIThreadExtensionFunction* function, |
| 59 const std::string& args); | 59 const std::string& args); |
| 60 | 60 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 87 | 87 |
| 88 MockExtensionSystemFactory<MockExtensionSystem> extension_system_factory_; | 88 MockExtensionSystemFactory<MockExtensionSystem> extension_system_factory_; |
| 89 | 89 |
| 90 // The Extension used when running API function calls. | 90 // The Extension used when running API function calls. |
| 91 scoped_refptr<Extension> extension_; | 91 scoped_refptr<Extension> extension_; |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 } // namespace extensions | 94 } // namespace extensions |
| 95 | 95 |
| 96 #endif // EXTENSIONS_BROWSER_API_UNITTEST_H_ | 96 #endif // EXTENSIONS_BROWSER_API_UNITTEST_H_ |
| OLD | NEW |