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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 EXPECT_CALL(*Manager(mgr_idx), RemoveObserver(_)); | 58 EXPECT_CALL(*Manager(mgr_idx), RemoveObserver(_)); |
59 } | 59 } |
60 | 60 |
61 delete updater_; | 61 delete updater_; |
62 updater_ = NULL; | 62 updater_ = NULL; |
63 VerifyAndClearExpectations(); | 63 VerifyAndClearExpectations(); |
64 | 64 |
65 managers_.clear(); | 65 managers_.clear(); |
66 for (std::vector<Items>::iterator it = manager_items_.begin(); | 66 for (std::vector<Items>::iterator it = manager_items_.begin(); |
67 it != manager_items_.end(); ++it) | 67 it != manager_items_.end(); ++it) |
68 STLDeleteContainerPointers(it->begin(), it->end()); | 68 base::STLDeleteContainerPointers(it->begin(), it->end()); |
69 | 69 |
70 base::RunLoop().RunUntilIdle(); // Allow DownloadManager destruction. | 70 base::RunLoop().RunUntilIdle(); // Allow DownloadManager destruction. |
71 } | 71 } |
72 | 72 |
73 protected: | 73 protected: |
74 // Attach some number of DownloadManagers to the updater. | 74 // Attach some number of DownloadManagers to the updater. |
75 void SetupManagers(int manager_count) { | 75 void SetupManagers(int manager_count) { |
76 DCHECK_EQ(0U, managers_.size()); | 76 DCHECK_EQ(0U, managers_.size()); |
77 for (int i = 0; i < manager_count; ++i) { | 77 for (int i = 0; i < manager_count; ++i) { |
78 content::MockDownloadManager* mgr = | 78 content::MockDownloadManager* mgr = |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 SetItemValues(0, 0, 10, 20, false); | 336 SetItemValues(0, 0, 10, 20, false); |
337 SetItemValues(0, 1, 50, 60, false); | 337 SetItemValues(0, 1, 50, 60, false); |
338 SetItemValues(1, 0, 80, 90, false); | 338 SetItemValues(1, 0, 80, 90, false); |
339 | 339 |
340 float progress = -1; | 340 float progress = -1; |
341 int download_count = -1; | 341 int download_count = -1; |
342 EXPECT_TRUE(updater_->GetProgress(&progress, &download_count)); | 342 EXPECT_TRUE(updater_->GetProgress(&progress, &download_count)); |
343 EXPECT_FLOAT_EQ((10+50+80)/(20.0f+60+90), progress); | 343 EXPECT_FLOAT_EQ((10+50+80)/(20.0f+60+90), progress); |
344 EXPECT_EQ(3, download_count); | 344 EXPECT_EQ(3, download_count); |
345 } | 345 } |
OLD | NEW |