| 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" | 
| 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 11 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 
| 12 #include "chrome/common/chrome_paths.h" | 12 #include "chrome/common/chrome_paths.h" | 
| 13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" | 
| 14 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" | 
| 15 #include "content/public/browser/plugin_service.h" | 15 #include "content/public/browser/plugin_service.h" | 
| 16 #include "content/public/test/browser_test_utils.h" | 16 #include "content/public/test/browser_test_utils.h" | 
| 17 #include "extensions/browser/extension_registry.h" | 17 #include "extensions/browser/extension_registry.h" | 
| 18 #include "extensions/common/manifest_handlers/mime_types_handler.h" | 18 #include "extensions/common/manifest_handlers/mime_types_handler.h" | 
| 19 #include "extensions/test/result_catcher.h" | 19 #include "extensions/test/result_catcher.h" | 
| 20 #include "grit/browser_resources.h" | 20 #include "grit/browser_resources.h" | 
| 21 #include "net/test/embedded_test_server/embedded_test_server.h" | 21 #include "net/test/embedded_test_server/embedded_test_server.h" | 
| 22 | 22 | 
| 23 class PDFExtensionTest : public ExtensionApiTest { | 23 class PDFExtensionTest : public ExtensionApiTest { | 
| 24  public: | 24  public: | 
| 25   virtual ~PDFExtensionTest() {} | 25   ~PDFExtensionTest() override {} | 
| 26 | 26 | 
| 27   virtual void SetUpCommandLine(base::CommandLine* command_line) override { | 27   void SetUpCommandLine(base::CommandLine* command_line) override { | 
| 28     ExtensionApiTest::SetUpCommandLine(command_line); | 28     ExtensionApiTest::SetUpCommandLine(command_line); | 
| 29     command_line->AppendSwitch(switches::kEnableOutOfProcessPdf); | 29     command_line->AppendSwitch(switches::kEnableOutOfProcessPdf); | 
| 30   } | 30   } | 
| 31 | 31 | 
| 32   virtual void SetUpOnMainThread() override { | 32   void SetUpOnMainThread() override { | 
| 33     ExtensionApiTest::SetUpOnMainThread(); | 33     ExtensionApiTest::SetUpOnMainThread(); | 
| 34     ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 34     ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 
| 35   } | 35   } | 
| 36 | 36 | 
| 37 | 37   void TearDownOnMainThread() override { | 
| 38   virtual void TearDownOnMainThread() override { |  | 
| 39     ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); | 38     ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); | 
| 40     ExtensionApiTest::TearDownOnMainThread(); | 39     ExtensionApiTest::TearDownOnMainThread(); | 
| 41   } | 40   } | 
| 42 | 41 | 
| 43   void RunTestsInFile(std::string filename, std::string pdf_filename) { | 42   void RunTestsInFile(std::string filename, std::string pdf_filename) { | 
| 44     ExtensionService* service = extensions::ExtensionSystem::Get( | 43     ExtensionService* service = extensions::ExtensionSystem::Get( | 
| 45         profile())->extension_service(); | 44         profile())->extension_service(); | 
| 46     service->component_loader()->Add(IDR_PDF_MANIFEST, | 45     service->component_loader()->Add(IDR_PDF_MANIFEST, | 
| 47         base::FilePath(FILE_PATH_LITERAL("pdf"))); | 46         base::FilePath(FILE_PATH_LITERAL("pdf"))); | 
| 48     const extensions::Extension* extension = | 47     const extensions::Extension* extension = | 
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 104   RunTestsInFile("navigator_test.js", "test.pdf"); | 103   RunTestsInFile("navigator_test.js", "test.pdf"); | 
| 105 } | 104 } | 
| 106 | 105 | 
| 107 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, ParamsParser) { | 106 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, ParamsParser) { | 
| 108   RunTestsInFile("params_parser_test.js", "test.pdf"); | 107   RunTestsInFile("params_parser_test.js", "test.pdf"); | 
| 109 } | 108 } | 
| 110 | 109 | 
| 111 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, ZoomManager) { | 110 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, ZoomManager) { | 
| 112   RunTestsInFile("zoom_manager_test.js", "test.pdf"); | 111   RunTestsInFile("zoom_manager_test.js", "test.pdf"); | 
| 113 } | 112 } | 
| OLD | NEW | 
|---|