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/base_paths.h" | 5 #include "base/base_paths.h" |
6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "chrome/browser/extensions/component_loader.h" | 8 #include "chrome/browser/extensions/component_loader.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 34 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
35 } | 35 } |
36 | 36 |
37 | 37 |
38 virtual void TearDownOnMainThread() override { | 38 virtual void TearDownOnMainThread() override { |
39 ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); | 39 ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); |
40 ExtensionApiTest::TearDownOnMainThread(); | 40 ExtensionApiTest::TearDownOnMainThread(); |
41 } | 41 } |
42 | 42 |
43 void RunTestsInFile(std::string filename, std::string pdf_filename) { | 43 void RunTestsInFile(std::string filename, std::string pdf_filename) { |
| 44 base::FilePath pdf_path; |
| 45 ASSERT_TRUE(PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path)); |
| 46 ASSERT_TRUE( |
| 47 content::PluginService::GetInstance()->GetRegisteredPpapiPluginInfo( |
| 48 pdf_path)); |
44 ExtensionService* service = extensions::ExtensionSystem::Get( | 49 ExtensionService* service = extensions::ExtensionSystem::Get( |
45 profile())->extension_service(); | 50 profile())->extension_service(); |
46 service->component_loader()->Add(IDR_PDF_MANIFEST, | 51 service->component_loader()->Add(IDR_PDF_MANIFEST, |
47 base::FilePath(FILE_PATH_LITERAL("pdf"))); | 52 base::FilePath(FILE_PATH_LITERAL("pdf"))); |
48 const extensions::Extension* extension = | 53 const extensions::Extension* extension = |
49 extensions::ExtensionRegistry::Get(profile()) | 54 extensions::ExtensionRegistry::Get(profile()) |
50 ->enabled_extensions() | 55 ->enabled_extensions() |
51 .GetByID("mhjfbmdgcfjbbpaeojofohoefgiehjai"); | 56 .GetByID("mhjfbmdgcfjbbpaeojofohoefgiehjai"); |
52 ASSERT_TRUE(extension); | 57 ASSERT_TRUE(extension); |
53 ASSERT_TRUE(MimeTypesHandler::GetHandler( | 58 ASSERT_TRUE(MimeTypesHandler::GetHandler( |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 RunTestsInFile("bookmarks_test.js", "test-bookmarks.pdf"); | 105 RunTestsInFile("bookmarks_test.js", "test-bookmarks.pdf"); |
101 } | 106 } |
102 | 107 |
103 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Navigator) { | 108 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Navigator) { |
104 RunTestsInFile("navigator_test.js", "test.pdf"); | 109 RunTestsInFile("navigator_test.js", "test.pdf"); |
105 } | 110 } |
106 | 111 |
107 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, ParamsParser) { | 112 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, ParamsParser) { |
108 RunTestsInFile("params_parser_test.js", "test.pdf"); | 113 RunTestsInFile("params_parser_test.js", "test.pdf"); |
109 } | 114 } |
OLD | NEW |