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 <set> | 5 #include <set> |
6 #include <vector> | 6 #include <vector> |
7 | 7 |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "chrome/browser/download/download_history.h" | 10 #include "chrome/browser/download/download_history.h" |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 | 403 |
404 std::vector<content::DownloadItem*> items; | 404 std::vector<content::DownloadItem*> items; |
405 for (size_t i = 0; i < items_.size(); ++i) { | 405 for (size_t i = 0; i < items_.size(); ++i) { |
406 items.push_back(&item(i)); | 406 items.push_back(&item(i)); |
407 } | 407 } |
408 EXPECT_CALL(*manager_.get(), GetAllDownloads(_)) | 408 EXPECT_CALL(*manager_.get(), GetAllDownloads(_)) |
409 .WillRepeatedly(SetArgPointee<0>(items)); | 409 .WillRepeatedly(SetArgPointee<0>(items)); |
410 } | 410 } |
411 | 411 |
412 private: | 412 private: |
413 MessageLoopForUI loop_; | 413 base::MessageLoopForUI loop_; |
414 content::TestBrowserThread ui_thread_; | 414 content::TestBrowserThread ui_thread_; |
415 std::vector<NiceMockDownloadItem*> items_; | 415 std::vector<NiceMockDownloadItem*> items_; |
416 scoped_refptr<content::MockDownloadManager> manager_; | 416 scoped_refptr<content::MockDownloadManager> manager_; |
417 FakeHistoryAdapter* history_; | 417 FakeHistoryAdapter* history_; |
418 scoped_ptr<DownloadHistory> download_history_; | 418 scoped_ptr<DownloadHistory> download_history_; |
419 content::DownloadManager::Observer* manager_observer_; | 419 content::DownloadManager::Observer* manager_observer_; |
420 content::DownloadItem::Observer* item_observer_; | 420 content::DownloadItem::Observer* item_observer_; |
421 size_t download_created_index_; | 421 size_t download_created_index_; |
422 | 422 |
423 DISALLOW_COPY_AND_ASSIGN(DownloadHistoryTest); | 423 DISALLOW_COPY_AND_ASSIGN(DownloadHistoryTest); |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
803 item_observer()->OnDownloadUpdated(&item(0)); | 803 item_observer()->OnDownloadUpdated(&item(0)); |
804 | 804 |
805 FinishCreateDownload(); | 805 FinishCreateDownload(); |
806 EXPECT_TRUE(DownloadHistory::IsPersisted(&item(0))); | 806 EXPECT_TRUE(DownloadHistory::IsPersisted(&item(0))); |
807 | 807 |
808 // ItemAdded should call OnDownloadUpdated, which should detect that the item | 808 // ItemAdded should call OnDownloadUpdated, which should detect that the item |
809 // changed while it was being added and call UpdateDownload immediately. | 809 // changed while it was being added and call UpdateDownload immediately. |
810 info.opened = true; | 810 info.opened = true; |
811 ExpectDownloadUpdated(info); | 811 ExpectDownloadUpdated(info); |
812 } | 812 } |
OLD | NEW |