| 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 "base/memory/scoped_vector.h" | 5 #include "base/memory/scoped_vector.h" |
| 6 #include "base/memory/weak_ptr.h" | 6 #include "base/memory/weak_ptr.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "chrome/browser/download/download_status_updater.h" | 9 #include "chrome/browser/download/download_status_updater.h" |
| 10 #include "content/public/test/mock_download_item.h" | 10 #include "content/public/test/mock_download_item.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 size_t notification_count_; | 43 size_t notification_count_; |
| 44 content::DownloadItem* acceptable_notification_item_; | 44 content::DownloadItem* acceptable_notification_item_; |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 class DownloadStatusUpdaterTest : public testing::Test { | 47 class DownloadStatusUpdaterTest : public testing::Test { |
| 48 public: | 48 public: |
| 49 DownloadStatusUpdaterTest() | 49 DownloadStatusUpdaterTest() |
| 50 : updater_(new TestDownloadStatusUpdater()), | 50 : updater_(new TestDownloadStatusUpdater()), |
| 51 ui_thread_(content::BrowserThread::UI, &loop_) {} | 51 ui_thread_(content::BrowserThread::UI, &loop_) {} |
| 52 | 52 |
| 53 virtual ~DownloadStatusUpdaterTest() { | 53 ~DownloadStatusUpdaterTest() override { |
| 54 for (size_t mgr_idx = 0; mgr_idx < managers_.size(); ++mgr_idx) { | 54 for (size_t mgr_idx = 0; mgr_idx < managers_.size(); ++mgr_idx) { |
| 55 EXPECT_CALL(*Manager(mgr_idx), RemoveObserver(_)); | 55 EXPECT_CALL(*Manager(mgr_idx), RemoveObserver(_)); |
| 56 } | 56 } |
| 57 | 57 |
| 58 delete updater_; | 58 delete updater_; |
| 59 updater_ = NULL; | 59 updater_ = NULL; |
| 60 VerifyAndClearExpectations(); | 60 VerifyAndClearExpectations(); |
| 61 | 61 |
| 62 managers_.clear(); | 62 managers_.clear(); |
| 63 for (std::vector<Items>::iterator it = manager_items_.begin(); | 63 for (std::vector<Items>::iterator it = manager_items_.begin(); |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 SetItemValues(0, 0, 10, 20, false); | 333 SetItemValues(0, 0, 10, 20, false); |
| 334 SetItemValues(0, 1, 50, 60, false); | 334 SetItemValues(0, 1, 50, 60, false); |
| 335 SetItemValues(1, 0, 80, 90, false); | 335 SetItemValues(1, 0, 80, 90, false); |
| 336 | 336 |
| 337 float progress = -1; | 337 float progress = -1; |
| 338 int download_count = -1; | 338 int download_count = -1; |
| 339 EXPECT_TRUE(updater_->GetProgress(&progress, &download_count)); | 339 EXPECT_TRUE(updater_->GetProgress(&progress, &download_count)); |
| 340 EXPECT_FLOAT_EQ((10+50+80)/(20.0f+60+90), progress); | 340 EXPECT_FLOAT_EQ((10+50+80)/(20.0f+60+90), progress); |
| 341 EXPECT_EQ(3, download_count); | 341 EXPECT_EQ(3, download_count); |
| 342 } | 342 } |
| OLD | NEW |