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 // Disable everything on windows only. http://crbug.com/306144 | 5 // Disable everything on windows only. http://crbug.com/306144 |
6 #ifndef OS_WIN | 6 #ifndef OS_WIN |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "content/public/browser/browser_context.h" | 41 #include "content/public/browser/browser_context.h" |
42 #include "content/public/browser/browser_thread.h" | 42 #include "content/public/browser/browser_thread.h" |
43 #include "content/public/browser/download_item.h" | 43 #include "content/public/browser/download_item.h" |
44 #include "content/public/browser/download_manager.h" | 44 #include "content/public/browser/download_manager.h" |
45 #include "content/public/browser/notification_service.h" | 45 #include "content/public/browser/notification_service.h" |
46 #include "content/public/browser/storage_partition.h" | 46 #include "content/public/browser/storage_partition.h" |
47 #include "content/public/browser/web_contents.h" | 47 #include "content/public/browser/web_contents.h" |
48 #include "content/public/common/content_features.h" | 48 #include "content/public/common/content_features.h" |
49 #include "content/public/test/download_test_observer.h" | 49 #include "content/public/test/download_test_observer.h" |
50 #include "content/public/test/test_download_request_handler.h" | 50 #include "content/public/test/test_download_request_handler.h" |
| 51 #include "content/public/test/test_utils.h" |
51 #include "extensions/browser/event_router.h" | 52 #include "extensions/browser/event_router.h" |
52 #include "extensions/browser/notification_types.h" | 53 #include "extensions/browser/notification_types.h" |
53 #include "net/base/data_url.h" | 54 #include "net/base/data_url.h" |
54 #include "net/test/embedded_test_server/embedded_test_server.h" | 55 #include "net/test/embedded_test_server/embedded_test_server.h" |
55 #include "net/test/url_request/url_request_slow_download_job.h" | 56 #include "net/test/url_request/url_request_slow_download_job.h" |
56 #include "net/url_request/url_request.h" | 57 #include "net/url_request/url_request.h" |
57 #include "net/url_request/url_request_context.h" | 58 #include "net/url_request/url_request_context.h" |
58 #include "net/url_request/url_request_job.h" | 59 #include "net/url_request/url_request_job.h" |
59 #include "net/url_request/url_request_job_factory.h" | 60 #include "net/url_request/url_request_job_factory.h" |
60 #include "net/url_request/url_request_job_factory_impl.h" | 61 #include "net/url_request/url_request_job_factory_impl.h" |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 // Now create another download. | 996 // Now create another download. |
996 download_item = CreateSlowTestDownload(); | 997 download_item = CreateSlowTestDownload(); |
997 ASSERT_TRUE(download_item); | 998 ASSERT_TRUE(download_item); |
998 ASSERT_FALSE(download_item->GetTargetFilePath().empty()); | 999 ASSERT_FALSE(download_item->GetTargetFilePath().empty()); |
999 args32 = base::StringPrintf("[%d, {\"size\": 32}]", download_item->GetId()); | 1000 args32 = base::StringPrintf("[%d, {\"size\": 32}]", download_item->GetId()); |
1000 | 1001 |
1001 // Cancel the download. As long as the download has a target path, we should | 1002 // Cancel the download. As long as the download has a target path, we should |
1002 // be able to query the file icon. | 1003 // be able to query the file icon. |
1003 download_item->Cancel(true); | 1004 download_item->Cancel(true); |
1004 ASSERT_FALSE(download_item->GetTargetFilePath().empty()); | 1005 ASSERT_FALSE(download_item->GetTargetFilePath().empty()); |
1005 // Let cleanup complete on the FILE thread. | 1006 // Let cleanup complete on blocking threads. |
1006 content::RunAllPendingInMessageLoop(BrowserThread::FILE); | 1007 content::RunAllBlockingPoolTasksUntilIdle(); |
1007 // Check the path passed to the icon extractor post-cancellation. | 1008 // Check the path passed to the icon extractor post-cancellation. |
1008 EXPECT_TRUE(RunFunctionAndReturnString(MockedGetFileIconFunction( | 1009 EXPECT_TRUE(RunFunctionAndReturnString(MockedGetFileIconFunction( |
1009 download_item->GetTargetFilePath(), IconLoader::NORMAL, "foo"), | 1010 download_item->GetTargetFilePath(), IconLoader::NORMAL, "foo"), |
1010 args32, | 1011 args32, |
1011 &result_string)); | 1012 &result_string)); |
1012 | 1013 |
1013 // Simulate an error during icon load by invoking the mock with an empty | 1014 // Simulate an error during icon load by invoking the mock with an empty |
1014 // result string. | 1015 // result string. |
1015 std::string error = RunFunctionAndReturnError( | 1016 std::string error = RunFunctionAndReturnError( |
1016 MockedGetFileIconFunction(download_item->GetTargetFilePath(), | 1017 MockedGetFileIconFunction(download_item->GetTargetFilePath(), |
(...skipping 3287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4304 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); | 4305 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); |
4305 EXPECT_FALSE(warnings.empty()); | 4306 EXPECT_FALSE(warnings.empty()); |
4306 EXPECT_EQ(Warning::kDownloadFilenameConflict, | 4307 EXPECT_EQ(Warning::kDownloadFilenameConflict, |
4307 warnings.begin()->warning_type()); | 4308 warnings.begin()->warning_type()); |
4308 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); | 4309 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); |
4309 } | 4310 } |
4310 | 4311 |
4311 } // namespace extensions | 4312 } // namespace extensions |
4312 | 4313 |
4313 #endif // http://crbug.com/306144 | 4314 #endif // http://crbug.com/306144 |
OLD | NEW |