Chromium Code Reviews| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 url.spec()); | 66 url.spec()); |
| 67 ui_test_utils::NavigateToURL(browser(), extension_url); | 67 ui_test_utils::NavigateToURL(browser(), extension_url); |
| 68 content::WebContents* contents = | 68 content::WebContents* contents = |
| 69 browser()->tab_strip_model()->GetActiveWebContents(); | 69 browser()->tab_strip_model()->GetActiveWebContents(); |
| 70 content::WaitForLoadStop(contents); | 70 content::WaitForLoadStop(contents); |
| 71 | 71 |
| 72 base::FilePath test_data_dir; | 72 base::FilePath test_data_dir; |
| 73 PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir); | 73 PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir); |
| 74 test_data_dir = test_data_dir.Append( | 74 test_data_dir = test_data_dir.Append( |
| 75 FILE_PATH_LITERAL("chrome/test/data/pdf")); | 75 FILE_PATH_LITERAL("chrome/test/data/pdf")); |
| 76 test_data_dir = test_data_dir.AppendASCII(filename); | 76 base::FilePath test_util_path = test_data_dir.AppendASCII("test_util.js"); |
| 77 std::string test_util_js; | |
| 78 ASSERT_TRUE(base::ReadFileToString(test_util_path, &test_util_js)); | |
| 77 | 79 |
| 80 base::FilePath test_file_path = test_data_dir.AppendASCII(filename); | |
| 78 std::string test_js; | 81 std::string test_js; |
| 79 ASSERT_TRUE(base::ReadFileToString(test_data_dir, &test_js)); | 82 ASSERT_TRUE(base::ReadFileToString(test_file_path, &test_js)); |
| 80 ASSERT_TRUE(content::ExecuteScript(contents, test_js)); | 83 |
| 84 test_util_js.append(test_js); | |
| 85 ASSERT_TRUE(content::ExecuteScript(contents, test_util_js)); | |
| 81 | 86 |
| 82 if (!catcher.GetNextResult()) | 87 if (!catcher.GetNextResult()) |
| 83 FAIL() << catcher.message(); | 88 FAIL() << catcher.message(); |
| 84 } | 89 } |
| 85 }; | 90 }; |
| 86 | 91 |
| 87 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Basic) { | 92 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Basic) { |
| 88 RunTestsInFile("basic_test.js", "test.pdf"); | 93 RunTestsInFile("basic_test.js", "test.pdf"); |
| 89 } | 94 } |
| 90 | 95 |
| 91 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, BasicPlugin) { | 96 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, BasicPlugin) { |
| 92 RunTestsInFile("basic_plugin_test.js", "test.pdf"); | 97 RunTestsInFile("basic_plugin_test.js", "test.pdf"); |
| 93 } | 98 } |
| 94 | 99 |
| 95 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Viewport) { | 100 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Viewport) { |
| 96 RunTestsInFile("viewport_test.js", "test.pdf"); | 101 RunTestsInFile("viewport_test.js", "test.pdf"); |
| 97 } | 102 } |
| 98 | 103 |
| 99 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Bookmark) { | 104 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Bookmark) { |
| 100 RunTestsInFile("bookmarks_test.js", "test-bookmarks.pdf"); | 105 RunTestsInFile("bookmarks_test.js", "test-bookmarks.pdf"); |
| 101 } | 106 } |
| 107 | |
| 108 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Navigator) { | |
| 109 RunTestsInFile("navigator_test.js", "test.pdf"); | |
| 110 } | |
| 111 | |
| 112 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, NamedDestionations) { | |
|
raymes
2015/02/01 23:50:38
nit: NamedDestionations->ParamsParser
Deepak
2015/02/02 04:00:12
Done.
| |
| 113 RunTestsInFile("params_parser_test.js", "test.pdf"); | |
| 114 } | |
| OLD | NEW |