| 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_RENDERER_API_TEST_BASE_H_ | 5 #ifndef EXTENSIONS_RENDERER_API_TEST_BASE_H_ |
| 6 #define EXTENSIONS_RENDERER_API_TEST_BASE_H_ | 6 #define EXTENSIONS_RENDERER_API_TEST_BASE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // 2. Write JS tests in extensions/test/data/test_file.js. | 67 // 2. Write JS tests in extensions/test/data/test_file.js. |
| 68 // 3. Write one C++ test function for each JS test containing | 68 // 3. Write one C++ test function for each JS test containing |
| 69 // RunTest("test_file.js", "testFunctionName"). | 69 // RunTest("test_file.js", "testFunctionName"). |
| 70 // See extensions/renderer/api_test_base_unittest.cc and | 70 // See extensions/renderer/api_test_base_unittest.cc and |
| 71 // extensions/test/data/api_test_base_unittest.js for sample usage. | 71 // extensions/test/data/api_test_base_unittest.js for sample usage. |
| 72 class ApiTestBase : public ModuleSystemTest { | 72 class ApiTestBase : public ModuleSystemTest { |
| 73 protected: | 73 protected: |
| 74 ApiTestBase(); | 74 ApiTestBase(); |
| 75 virtual ~ApiTestBase(); | 75 virtual ~ApiTestBase(); |
| 76 virtual void SetUp() OVERRIDE; | 76 virtual void SetUp() OVERRIDE; |
| 77 virtual void TearDown() OVERRIDE; |
| 77 void RunTest(const std::string& file_name, const std::string& test_name); | 78 void RunTest(const std::string& file_name, const std::string& test_name); |
| 78 TestServiceProvider* service_provider() { return service_provider_; } | 79 TestServiceProvider* service_provider() { return service_provider_; } |
| 79 | 80 |
| 80 private: | 81 private: |
| 81 void RegisterModules(); | 82 void RegisterModules(); |
| 82 void InitializeEnvironment(); | 83 void InitializeEnvironment(); |
| 83 void RunTestInner(const std::string& test_name, | 84 void RunTestInner(const std::string& test_name, |
| 84 const base::Closure& quit_closure); | 85 const base::Closure& quit_closure); |
| 85 void RunPromisesAgain(); | 86 void RunPromisesAgain(); |
| 86 | 87 |
| 87 base::MessageLoop message_loop_; | 88 base::MessageLoop message_loop_; |
| 88 TestServiceProvider* service_provider_; | 89 TestServiceProvider* service_provider_; |
| 89 scoped_ptr<V8SchemaRegistry> v8_schema_registry_; | 90 scoped_ptr<V8SchemaRegistry> v8_schema_registry_; |
| 90 }; | 91 }; |
| 91 | 92 |
| 92 } // namespace extensions | 93 } // namespace extensions |
| 93 | 94 |
| 94 #endif // EXTENSIONS_RENDERER_API_TEST_BASE_H_ | 95 #endif // EXTENSIONS_RENDERER_API_TEST_BASE_H_ |
| OLD | NEW |