| 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)); | |
| 49 ExtensionService* service = extensions::ExtensionSystem::Get( | 44 ExtensionService* service = extensions::ExtensionSystem::Get( |
| 50 profile())->extension_service(); | 45 profile())->extension_service(); |
| 51 service->component_loader()->Add(IDR_PDF_MANIFEST, | 46 service->component_loader()->Add(IDR_PDF_MANIFEST, |
| 52 base::FilePath(FILE_PATH_LITERAL("pdf"))); | 47 base::FilePath(FILE_PATH_LITERAL("pdf"))); |
| 53 const extensions::Extension* extension = | 48 const extensions::Extension* extension = |
| 54 extensions::ExtensionRegistry::Get(profile()) | 49 extensions::ExtensionRegistry::Get(profile()) |
| 55 ->enabled_extensions() | 50 ->enabled_extensions() |
| 56 .GetByID("mhjfbmdgcfjbbpaeojofohoefgiehjai"); | 51 .GetByID("mhjfbmdgcfjbbpaeojofohoefgiehjai"); |
| 57 ASSERT_TRUE(extension); | 52 ASSERT_TRUE(extension); |
| 58 ASSERT_TRUE(MimeTypesHandler::GetHandler( | 53 ASSERT_TRUE(MimeTypesHandler::GetHandler( |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 RunTestsInFile("basic_plugin_test.js", "test.pdf"); | 87 RunTestsInFile("basic_plugin_test.js", "test.pdf"); |
| 93 } | 88 } |
| 94 | 89 |
| 95 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Viewport) { | 90 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Viewport) { |
| 96 RunTestsInFile("viewport_test.js", "test.pdf"); | 91 RunTestsInFile("viewport_test.js", "test.pdf"); |
| 97 } | 92 } |
| 98 | 93 |
| 99 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Bookmark) { | 94 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Bookmark) { |
| 100 RunTestsInFile("bookmarks_test.js", "test-bookmarks.pdf"); | 95 RunTestsInFile("bookmarks_test.js", "test-bookmarks.pdf"); |
| 101 } | 96 } |
| OLD | NEW |