Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: extensions/renderer/api/mojo_private/mojo_private_unittest.cc

Issue 2409073002: Use mojo from the PDF extension instead of using an extension API.
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/renderer/BUILD.gn ('k') | extensions/renderer/api_test_base.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "extensions/renderer/api_test_base.h"
6
7 #include "base/macros.h"
8 #include "gin/modules/module_registry.h"
9
10 // A test launcher for tests for the mojoPrivate API defined in
11 // extensions/test/data/mojo_private_unittest.js.
12
13 namespace extensions {
14
15 class MojoPrivateApiTest : public ApiTestBase {
16 public:
17 MojoPrivateApiTest() = default;
18
19 gin::ModuleRegistry* module_registry() {
20 return gin::ModuleRegistry::From(env()->context()->v8_context());
21 }
22
23 private:
24 DISALLOW_COPY_AND_ASSIGN(MojoPrivateApiTest);
25 };
26
27 TEST_F(MojoPrivateApiTest, Define) {
28 ASSERT_NO_FATAL_FAILURE(RunTest("mojo_private_unittest.js", "testDefine"));
29 EXPECT_EQ(1u, module_registry()->available_modules().count("testModule"));
30 }
31
32 TEST_F(MojoPrivateApiTest, DefineRegistersModule) {
33 ASSERT_NO_FATAL_FAILURE(
34 RunTest("mojo_private_unittest.js", "testDefineRegistersModule"));
35 EXPECT_EQ(1u, module_registry()->available_modules().count("testModule"));
36 EXPECT_EQ(1u, module_registry()->available_modules().count("dependency"));
37 }
38
39 TEST_F(MojoPrivateApiTest, DefineModuleDoesNotExist) {
40 ASSERT_NO_FATAL_FAILURE(
41 RunTest("mojo_private_unittest.js", "testDefineModuleDoesNotExist"));
42 EXPECT_EQ(0u, module_registry()->available_modules().count("testModule"));
43 EXPECT_EQ(0u,
44 module_registry()->available_modules().count("does not exist!"));
45 EXPECT_EQ(1u, module_registry()->unsatisfied_dependencies().count(
46 "does not exist!"));
47 }
48
49 TEST_F(MojoPrivateApiTest, RequireAsync) {
50 ASSERT_NO_FATAL_FAILURE(
51 RunTest("mojo_private_unittest.js", "testRequireAsync"));
52 }
53
54 TEST_F(MojoPrivateApiTest, DefineAndRequire) {
55 ASSERT_NO_FATAL_FAILURE(
56 RunTest("mojo_private_unittest.js", "testDefineAndRequire"));
57 }
58
59 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/BUILD.gn ('k') | extensions/renderer/api_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698