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 #include <algorithm> | 5 #include <algorithm> |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 | 961 |
962 // Now create another download. | 962 // Now create another download. |
963 download_item = CreateSlowTestDownload(); | 963 download_item = CreateSlowTestDownload(); |
964 ASSERT_TRUE(download_item); | 964 ASSERT_TRUE(download_item); |
965 expected_path = download_item->GetTargetFilePath(); | 965 expected_path = download_item->GetTargetFilePath(); |
966 | 966 |
967 // Cancel the download. As long as the download has a target path, we should | 967 // Cancel the download. As long as the download has a target path, we should |
968 // be able to query the file icon. | 968 // be able to query the file icon. |
969 download_item->Cancel(true); | 969 download_item->Cancel(true); |
970 // Let cleanup complete on the FILE thread. | 970 // Let cleanup complete on the FILE thread. |
971 ui_test_utils::RunAllPendingInMessageLoop(BrowserThread::FILE); | 971 content::RunAllPendingInMessageLoop(BrowserThread::FILE); |
972 args = base::StringPrintf("[%d, {\"size\": 32}]", download_item->GetId()); | 972 args = base::StringPrintf("[%d, {\"size\": 32}]", download_item->GetId()); |
973 EXPECT_TRUE(RunFunctionAndReturnString(new DownloadsGetFileIconFunction(), | 973 EXPECT_TRUE(RunFunctionAndReturnString(new DownloadsGetFileIconFunction(), |
974 args, &result_string)); | 974 args, &result_string)); |
975 ExpectDataURLIsPNGWithSize(result_string, 32); | 975 ExpectDataURLIsPNGWithSize(result_string, 32); |
976 | 976 |
977 // Check the path passed to the icon extractor post-cancellation. | 977 // Check the path passed to the icon extractor post-cancellation. |
978 function = new DownloadsGetFileIconFunction(); | 978 function = new DownloadsGetFileIconFunction(); |
979 function->SetIconExtractorForTesting(new MockIconExtractorImpl( | 979 function->SetIconExtractorForTesting(new MockIconExtractorImpl( |
980 expected_path, IconLoader::NORMAL, "foo")); | 980 expected_path, IconLoader::NORMAL, "foo")); |
981 EXPECT_TRUE(RunFunctionAndReturnString(function.release(), args, | 981 EXPECT_TRUE(RunFunctionAndReturnString(function.release(), args, |
(...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2154 " \"state\": {" | 2154 " \"state\": {" |
2155 " \"previous\": \"in_progress\"," | 2155 " \"previous\": \"in_progress\"," |
2156 " \"current\": \"complete\"}}]", | 2156 " \"current\": \"complete\"}}]", |
2157 result_id, | 2157 result_id, |
2158 GetFilename("on_record.txt.crdownload").c_str(), | 2158 GetFilename("on_record.txt.crdownload").c_str(), |
2159 GetFilename("on_record.txt").c_str()))); | 2159 GetFilename("on_record.txt").c_str()))); |
2160 std::string disk_data; | 2160 std::string disk_data; |
2161 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); | 2161 EXPECT_TRUE(file_util::ReadFileToString(item->GetFullPath(), &disk_data)); |
2162 EXPECT_STREQ(kPayloadData, disk_data.c_str()); | 2162 EXPECT_STREQ(kPayloadData, disk_data.c_str()); |
2163 } | 2163 } |
OLD | NEW |