OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file contains download browser tests that are known to be runnable | 5 // This file contains download browser tests that are known to be runnable |
6 // in a pure content context. Over time tests should be migrated here. | 6 // in a pure content context. Over time tests should be migrated here. |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 #include <utility> | 10 #include <utility> |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 #include "content/shell/browser/shell.h" | 48 #include "content/shell/browser/shell.h" |
49 #include "content/shell/browser/shell_browser_context.h" | 49 #include "content/shell/browser/shell_browser_context.h" |
50 #include "content/shell/browser/shell_download_manager_delegate.h" | 50 #include "content/shell/browser/shell_download_manager_delegate.h" |
51 #include "content/shell/browser/shell_network_delegate.h" | 51 #include "content/shell/browser/shell_network_delegate.h" |
52 #include "device/power_save_blocker/power_save_blocker.h" | 52 #include "device/power_save_blocker/power_save_blocker.h" |
53 #include "net/test/embedded_test_server/embedded_test_server.h" | 53 #include "net/test/embedded_test_server/embedded_test_server.h" |
54 #include "net/test/embedded_test_server/http_request.h" | 54 #include "net/test/embedded_test_server/http_request.h" |
55 #include "net/test/embedded_test_server/http_response.h" | 55 #include "net/test/embedded_test_server/http_response.h" |
56 #include "net/test/url_request/url_request_mock_http_job.h" | 56 #include "net/test/url_request/url_request_mock_http_job.h" |
57 #include "net/test/url_request/url_request_slow_download_job.h" | 57 #include "net/test/url_request/url_request_slow_download_job.h" |
| 58 #include "ppapi/features/features.h" |
58 #include "testing/gmock/include/gmock/gmock.h" | 59 #include "testing/gmock/include/gmock/gmock.h" |
59 #include "testing/gtest/include/gtest/gtest.h" | 60 #include "testing/gtest/include/gtest/gtest.h" |
60 #include "url/gurl.h" | 61 #include "url/gurl.h" |
61 | 62 |
62 #if defined(ENABLE_PLUGINS) | 63 #if BUILDFLAG(ENABLE_PLUGINS) |
63 #include "content/browser/plugin_service_impl.h" | 64 #include "content/browser/plugin_service_impl.h" |
64 #endif | 65 #endif |
65 | 66 |
66 using ::testing::AllOf; | 67 using ::testing::AllOf; |
67 using ::testing::Field; | 68 using ::testing::Field; |
68 using ::testing::InSequence; | 69 using ::testing::InSequence; |
69 using ::testing::Property; | 70 using ::testing::Property; |
70 using ::testing::Return; | 71 using ::testing::Return; |
71 using ::testing::StrictMock; | 72 using ::testing::StrictMock; |
72 using ::testing::_; | 73 using ::testing::_; |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 size_t file_size1 = net::URLRequestSlowDownloadJob::kFirstDownloadSize + | 798 size_t file_size1 = net::URLRequestSlowDownloadJob::kFirstDownloadSize + |
798 net::URLRequestSlowDownloadJob::kSecondDownloadSize; | 799 net::URLRequestSlowDownloadJob::kSecondDownloadSize; |
799 std::string expected_contents(file_size1, '*'); | 800 std::string expected_contents(file_size1, '*'); |
800 ASSERT_TRUE(VerifyFile(file1, expected_contents, file_size1)); | 801 ASSERT_TRUE(VerifyFile(file1, expected_contents, file_size1)); |
801 | 802 |
802 base::FilePath file2(download2->GetTargetFilePath()); | 803 base::FilePath file2(download2->GetTargetFilePath()); |
803 ASSERT_TRUE(base::ContentsEqual( | 804 ASSERT_TRUE(base::ContentsEqual( |
804 file2, GetTestFilePath("download", "download-test.lib"))); | 805 file2, GetTestFilePath("download", "download-test.lib"))); |
805 } | 806 } |
806 | 807 |
807 #if defined(ENABLE_PLUGINS) | 808 #if BUILDFLAG(ENABLE_PLUGINS) |
808 // Content served with a MIME type of application/octet-stream should be | 809 // Content served with a MIME type of application/octet-stream should be |
809 // downloaded even when a plugin can be found that handles the file type. | 810 // downloaded even when a plugin can be found that handles the file type. |
810 IN_PROC_BROWSER_TEST_F(DownloadContentTest, DownloadOctetStream) { | 811 IN_PROC_BROWSER_TEST_F(DownloadContentTest, DownloadOctetStream) { |
811 const char kTestPluginName[] = "TestPlugin"; | 812 const char kTestPluginName[] = "TestPlugin"; |
812 const char kTestMimeType[] = "application/x-test-mime-type"; | 813 const char kTestMimeType[] = "application/x-test-mime-type"; |
813 const char kTestFileType[] = "abc"; | 814 const char kTestFileType[] = "abc"; |
814 | 815 |
815 WebPluginInfo plugin_info; | 816 WebPluginInfo plugin_info; |
816 plugin_info.name = base::ASCIIToUTF16(kTestPluginName); | 817 plugin_info.name = base::ASCIIToUTF16(kTestPluginName); |
817 plugin_info.mime_types.push_back( | 818 plugin_info.mime_types.push_back( |
(...skipping 1730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2548 GURL document_url = | 2549 GURL document_url = |
2549 origin_two.GetURL("/iframe-host.html?target=" + frame_url.spec()); | 2550 origin_two.GetURL("/iframe-host.html?target=" + frame_url.spec()); |
2550 DownloadItem* download = StartDownloadAndReturnItem(shell(), document_url); | 2551 DownloadItem* download = StartDownloadAndReturnItem(shell(), document_url); |
2551 WaitForCompletion(download); | 2552 WaitForCompletion(download); |
2552 | 2553 |
2553 EXPECT_STREQ(FILE_PATH_LITERAL("download-test.lib"), | 2554 EXPECT_STREQ(FILE_PATH_LITERAL("download-test.lib"), |
2554 download->GetTargetFilePath().BaseName().value().c_str()); | 2555 download->GetTargetFilePath().BaseName().value().c_str()); |
2555 } | 2556 } |
2556 | 2557 |
2557 } // namespace content | 2558 } // namespace content |
OLD | NEW |