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 #include "base/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
6 #include "extensions/renderer/module_system_test.h" | 6 #include "extensions/renderer/module_system_test.h" |
7 #include "grit/extensions_renderer_resources.h" | 7 #include "grit/extensions_renderer_resources.h" |
8 | 8 |
9 namespace extensions { | 9 namespace extensions { |
10 namespace { | 10 namespace { |
11 | 11 |
12 class MessagingUtilsUnittest : public ModuleSystemTest { | 12 class MessagingUtilsUnittest : public ModuleSystemTest { |
13 protected: | 13 protected: |
14 void RegisterTestModule(const char* code) { | 14 void RegisterTestModule(const char* code) { |
15 env()->RegisterModule( | 15 env()->RegisterModule( |
16 "test", | 16 "test", |
17 base::StringPrintf( | 17 base::StringPrintf( |
18 "var assert = requireNative('assert');\n" | 18 "var assert = requireNative('assert');\n" |
19 "var AssertTrue = assert.AssertTrue;\n" | 19 "var AssertTrue = assert.AssertTrue;\n" |
20 "var AssertFalse = assert.AssertFalse;\n" | 20 "var AssertFalse = assert.AssertFalse;\n" |
21 "var messagingUtils = require('messaging_utils');\n" | 21 "var messagingUtils = require('messaging_utils');\n" |
22 "%s", | 22 "%s", |
23 code)); | 23 code)); |
24 } | 24 } |
25 | 25 |
26 private: | 26 private: |
27 virtual void SetUp() OVERRIDE { | 27 virtual void SetUp() override { |
28 ModuleSystemTest::SetUp(); | 28 ModuleSystemTest::SetUp(); |
29 | 29 |
30 env()->RegisterModule("messaging_utils", IDR_MESSAGING_UTILS_JS); | 30 env()->RegisterModule("messaging_utils", IDR_MESSAGING_UTILS_JS); |
31 } | 31 } |
32 }; | 32 }; |
33 | 33 |
34 TEST_F(MessagingUtilsUnittest, TestNothing) { | 34 TEST_F(MessagingUtilsUnittest, TestNothing) { |
35 ExpectNoAssertionsMade(); | 35 ExpectNoAssertionsMade(); |
36 } | 36 } |
37 | 37 |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 "AssertTrue(args.length == 4);\n" | 187 "AssertTrue(args.length == 4);\n" |
188 "AssertTrue(args[0] === null);\n" | 188 "AssertTrue(args[0] === null);\n" |
189 "AssertTrue(args[1] == obj1);\n" | 189 "AssertTrue(args[1] == obj1);\n" |
190 "AssertTrue(args[2] == obj2);\n" | 190 "AssertTrue(args[2] == obj2);\n" |
191 "AssertTrue(args[3] === null);"); | 191 "AssertTrue(args[3] === null);"); |
192 env()->module_system()->Require("test"); | 192 env()->module_system()->Require("test"); |
193 } | 193 } |
194 | 194 |
195 } // namespace | 195 } // namespace |
196 } // namespace extensions | 196 } // namespace extensions |
OLD | NEW |