OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TEST_BASE_MODULE_SYSTEM_TEST_H_ | 5 #ifndef CHROME_TEST_BASE_MODULE_SYSTEM_TEST_H_ |
6 #define CHROME_TEST_BASE_MODULE_SYSTEM_TEST_H_ | 6 #define CHROME_TEST_BASE_MODULE_SYSTEM_TEST_H_ |
7 | 7 |
8 #include "chrome/renderer/extensions/module_system.h" | 8 #include "chrome/renderer/extensions/module_system.h" |
| 9 #include "chrome/renderer/extensions/scoped_persistent.h" |
9 #include "v8/include/v8.h" | 10 #include "v8/include/v8.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
11 | 12 |
12 class AssertNatives; | 13 class AssertNatives; |
13 class StringSourceMap; | 14 class StringSourceMap; |
14 | 15 |
15 // Test fixture for testing JS that makes use of the module system. | 16 // Test fixture for testing JS that makes use of the module system. |
16 // | 17 // |
17 // Typically tests will look like: | 18 // Typically tests will look like: |
18 // | 19 // |
(...skipping 24 matching lines...) Expand all Loading... |
43 // name. | 44 // name. |
44 void OverrideNativeHandler(const std::string& name, const std::string& code); | 45 void OverrideNativeHandler(const std::string& name, const std::string& code); |
45 | 46 |
46 // Make the test fail if any asserts are called. By default a test will fail | 47 // Make the test fail if any asserts are called. By default a test will fail |
47 // if no asserts are called. | 48 // if no asserts are called. |
48 void ExpectNoAssertionsMade(); | 49 void ExpectNoAssertionsMade(); |
49 | 50 |
50 // Create an empty object in the global scope with name |name|. | 51 // Create an empty object in the global scope with name |name|. |
51 v8::Handle<v8::Object> CreateGlobal(const std::string& name); | 52 v8::Handle<v8::Object> CreateGlobal(const std::string& name); |
52 | 53 |
53 v8::Persistent<v8::Context> context_; | 54 extensions::ScopedPersistent<v8::Context> context_; |
54 v8::HandleScope handle_scope_; | 55 v8::HandleScope handle_scope_; |
55 AssertNatives* assert_natives_; | 56 AssertNatives* assert_natives_; |
56 scoped_ptr<StringSourceMap> source_map_; | 57 scoped_ptr<StringSourceMap> source_map_; |
57 scoped_ptr<extensions::ModuleSystem> module_system_; | 58 scoped_ptr<extensions::ModuleSystem> module_system_; |
58 bool should_assertions_be_made_; | 59 bool should_assertions_be_made_; |
59 }; | 60 }; |
60 | 61 |
61 #endif // CHROME_TEST_BASE_MODULE_SYSTEM_TEST_H_ | 62 #endif // CHROME_TEST_BASE_MODULE_SYSTEM_TEST_H_ |
OLD | NEW |