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_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/common/extensions/manifest_handlers/mime_types_handler.h" | 13 #include "chrome/common/extensions/manifest_handlers/mime_types_handler.h" |
14 #include "chrome/test/base/ui_test_utils.h" | 14 #include "chrome/test/base/ui_test_utils.h" |
15 #include "content/public/test/browser_test_utils.h" | 15 #include "content/public/test/browser_test_utils.h" |
16 #include "extensions/test/result_catcher.h" | 16 #include "extensions/test/result_catcher.h" |
17 #include "grit/browser_resources.h" | 17 #include "grit/browser_resources.h" |
18 #include "net/test/embedded_test_server/embedded_test_server.h" | 18 #include "net/test/embedded_test_server/embedded_test_server.h" |
19 | 19 |
20 class PDFExtensionTest : public ExtensionApiTest { | 20 class PDFExtensionTest : public ExtensionApiTest { |
21 public: | 21 public: |
22 virtual ~PDFExtensionTest() {} | 22 virtual ~PDFExtensionTest() {} |
23 | 23 |
24 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 24 virtual void SetUpCommandLine(CommandLine* command_line) override { |
25 ExtensionApiTest::SetUpCommandLine(command_line); | 25 ExtensionApiTest::SetUpCommandLine(command_line); |
26 command_line->AppendSwitch(switches::kOutOfProcessPdf); | 26 command_line->AppendSwitch(switches::kOutOfProcessPdf); |
27 } | 27 } |
28 | 28 |
29 virtual void SetUpOnMainThread() OVERRIDE { | 29 virtual void SetUpOnMainThread() override { |
30 ExtensionApiTest::SetUpOnMainThread(); | 30 ExtensionApiTest::SetUpOnMainThread(); |
31 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 31 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
32 } | 32 } |
33 | 33 |
34 | 34 |
35 virtual void TearDownOnMainThread() OVERRIDE { | 35 virtual void TearDownOnMainThread() override { |
36 ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); | 36 ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); |
37 ExtensionApiTest::TearDownOnMainThread(); | 37 ExtensionApiTest::TearDownOnMainThread(); |
38 } | 38 } |
39 | 39 |
40 void RunTestsInFile(std::string filename, bool requiresPlugin) { | 40 void RunTestsInFile(std::string filename, bool requiresPlugin) { |
41 base::FilePath pdf_plugin_src; | 41 base::FilePath pdf_plugin_src; |
42 PathService::Get(base::DIR_SOURCE_ROOT, &pdf_plugin_src); | 42 PathService::Get(base::DIR_SOURCE_ROOT, &pdf_plugin_src); |
43 pdf_plugin_src = pdf_plugin_src.AppendASCII("pdf"); | 43 pdf_plugin_src = pdf_plugin_src.AppendASCII("pdf"); |
44 if (requiresPlugin && !base::DirectoryExists(pdf_plugin_src)) { | 44 if (requiresPlugin && !base::DirectoryExists(pdf_plugin_src)) { |
45 LOG(WARNING) << "Not running " << filename << | 45 LOG(WARNING) << "Not running " << filename << |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 RunTestsInFile("basic_test.js", false); | 86 RunTestsInFile("basic_test.js", false); |
87 } | 87 } |
88 | 88 |
89 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, BasicPlugin) { | 89 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, BasicPlugin) { |
90 RunTestsInFile("basic_plugin_test.js", true); | 90 RunTestsInFile("basic_plugin_test.js", true); |
91 } | 91 } |
92 | 92 |
93 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Viewport) { | 93 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Viewport) { |
94 RunTestsInFile("viewport_test.js", false); | 94 RunTestsInFile("viewport_test.js", false); |
95 } | 95 } |
OLD | NEW |