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 |
11 #include <algorithm> | 11 #include <algorithm> |
12 | 12 |
13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
14 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
| 15 #include "base/guid.h" |
15 #include "base/json/json_reader.h" | 16 #include "base/json/json_reader.h" |
16 #include "base/macros.h" | 17 #include "base/macros.h" |
17 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
18 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
19 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
20 #include "base/synchronization/waitable_event.h" | 21 #include "base/synchronization/waitable_event.h" |
21 #include "build/build_config.h" | 22 #include "build/build_config.h" |
22 #include "chrome/browser/download/download_file_icon_extractor.h" | 23 #include "chrome/browser/download/download_file_icon_extractor.h" |
23 #include "chrome/browser/download/download_service.h" | 24 #include "chrome/browser/download/download_service.h" |
24 #include "chrome/browser/download/download_service_factory.h" | 25 #include "chrome/browser/download/download_service_factory.h" |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 DownloadManager::DownloadVector* items) { | 420 DownloadManager::DownloadVector* items) { |
420 DownloadIdComparator download_id_comparator; | 421 DownloadIdComparator download_id_comparator; |
421 base::Time current = base::Time::Now(); | 422 base::Time current = base::Time::Now(); |
422 items->clear(); | 423 items->clear(); |
423 GetOnRecordManager()->GetAllDownloads(items); | 424 GetOnRecordManager()->GetAllDownloads(items); |
424 CHECK_EQ(0, static_cast<int>(items->size())); | 425 CHECK_EQ(0, static_cast<int>(items->size())); |
425 std::vector<GURL> url_chain; | 426 std::vector<GURL> url_chain; |
426 url_chain.push_back(GURL()); | 427 url_chain.push_back(GURL()); |
427 for (size_t i = 0; i < count; ++i) { | 428 for (size_t i = 0; i < count; ++i) { |
428 DownloadItem* item = GetOnRecordManager()->CreateDownloadItem( | 429 DownloadItem* item = GetOnRecordManager()->CreateDownloadItem( |
| 430 base::GenerateGUID(), |
429 content::DownloadItem::kInvalidId + 1 + i, | 431 content::DownloadItem::kInvalidId + 1 + i, |
430 downloads_directory().Append(history_info[i].filename), | 432 downloads_directory().Append(history_info[i].filename), |
431 downloads_directory().Append(history_info[i].filename), url_chain, | 433 downloads_directory().Append(history_info[i].filename), |
432 GURL(), // URL Chain, referrer | 434 url_chain, |
433 std::string(), std::string(), // mime_type, original_mime_type | 435 GURL(), // URL Chain, referrer |
434 current, current, // start_time, end_time | 436 std::string(), |
435 std::string(), std::string(), // etag, last_modified | 437 std::string(), // mime_type, original_mime_type |
436 1, 1, // received_bytes, total_bytes | 438 current, |
437 history_info[i].state, // state | 439 current, // start_time, end_time |
| 440 std::string(), |
| 441 std::string(), // etag, last_modified |
| 442 1, |
| 443 1, // received_bytes, total_bytes |
| 444 history_info[i].state, // state |
438 history_info[i].danger_type, | 445 history_info[i].danger_type, |
439 (history_info[i].state != content::DownloadItem::CANCELLED | 446 (history_info[i].state != content::DownloadItem::CANCELLED |
440 ? content::DOWNLOAD_INTERRUPT_REASON_NONE | 447 ? content::DOWNLOAD_INTERRUPT_REASON_NONE |
441 : content::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED), | 448 : content::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED), |
442 false); // opened | 449 false); // opened |
443 items->push_back(item); | 450 items->push_back(item); |
444 } | 451 } |
445 | 452 |
446 // Order by ID so that they are in the order that we created them. | 453 // Order by ID so that they are in the order that we created them. |
447 std::sort(items->begin(), items->end(), download_id_comparator); | 454 std::sort(items->begin(), items->end(), download_id_comparator); |
(...skipping 3729 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4177 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); | 4184 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); |
4178 EXPECT_FALSE(warnings.empty()); | 4185 EXPECT_FALSE(warnings.empty()); |
4179 EXPECT_EQ(Warning::kDownloadFilenameConflict, | 4186 EXPECT_EQ(Warning::kDownloadFilenameConflict, |
4180 warnings.begin()->warning_type()); | 4187 warnings.begin()->warning_type()); |
4181 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); | 4188 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); |
4182 } | 4189 } |
4183 | 4190 |
4184 } // namespace extensions | 4191 } // namespace extensions |
4185 | 4192 |
4186 #endif // http://crbug.com/306144 | 4193 #endif // http://crbug.com/306144 |
OLD | NEW |