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 |
|
raymes
2015/01/29 04:27:13
nit: no need to add a newline
Deepak
2015/01/29 06:05:41
Done.
| |
| 77 base::FilePath test_file_data_dir = test_data_dir.AppendASCII(filename); | |
|
raymes
2015/01/29 04:27:13
this can be called "test_file_path"
Deepak
2015/01/29 06:05:41
Done.
| |
| 77 | 78 |
| 78 std::string test_js; | 79 std::string test_js; |
| 79 ASSERT_TRUE(base::ReadFileToString(test_data_dir, &test_js)); | 80 ASSERT_TRUE(base::ReadFileToString(test_file_data_dir, &test_js)); |
| 81 | |
| 82 std::string test_common_js; | |
|
raymes
2015/01/29 04:27:13
test_util_js
Deepak
2015/01/29 06:05:41
Done.
| |
| 83 test_data_dir = test_data_dir.AppendASCII("test_util.js"); | |
|
raymes
2015/01/29 04:27:13
Create a separate base::FilePath here called "test
Deepak
2015/01/29 06:05:41
Done.
| |
| 84 ASSERT_TRUE(base::ReadFileToString(test_data_dir, &test_common_js)); | |
| 85 test_js.append(test_common_js); | |
|
raymes
2015/01/29 04:27:13
I would append the test_common_js before the test_
Deepak
2015/01/29 06:05:41
Done.
| |
| 86 | |
| 80 ASSERT_TRUE(content::ExecuteScript(contents, test_js)); | 87 ASSERT_TRUE(content::ExecuteScript(contents, test_js)); |
| 81 | 88 |
| 82 if (!catcher.GetNextResult()) | 89 if (!catcher.GetNextResult()) |
| 83 FAIL() << catcher.message(); | 90 FAIL() << catcher.message(); |
| 84 } | 91 } |
| 85 }; | 92 }; |
| 86 | 93 |
| 87 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Basic) { | 94 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Basic) { |
| 88 RunTestsInFile("basic_test.js", "test.pdf"); | 95 RunTestsInFile("basic_test.js", "test.pdf"); |
| 89 } | 96 } |
| 90 | 97 |
| 91 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, BasicPlugin) { | 98 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, BasicPlugin) { |
| 92 RunTestsInFile("basic_plugin_test.js", "test.pdf"); | 99 RunTestsInFile("basic_plugin_test.js", "test.pdf"); |
| 93 } | 100 } |
| 94 | 101 |
| 95 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Viewport) { | 102 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Viewport) { |
| 96 RunTestsInFile("viewport_test.js", "test.pdf"); | 103 RunTestsInFile("viewport_test.js", "test.pdf"); |
| 97 } | 104 } |
| 98 | 105 |
| 99 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Bookmark) { | 106 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Bookmark) { |
| 100 RunTestsInFile("bookmarks_test.js", "test-bookmarks.pdf"); | 107 RunTestsInFile("bookmarks_test.js", "test-bookmarks.pdf"); |
| 101 } | 108 } |
| 109 | |
| 110 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, Navigator) { | |
| 111 RunTestsInFile("navigator_test.js", "test.pdf"); | |
| 112 } | |
| 113 | |
| 114 IN_PROC_BROWSER_TEST_F(PDFExtensionTest, NamedDestionations) { | |
| 115 RunTestsInFile("params_parser_test.js", "test.pdf"); | |
| 116 } | |
| OLD | NEW |