Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: chrome/browser/download/download_status_updater_unittest.cc

Issue 2083363002: Remove calls to deprecated MessageLoop methods in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/stl_util.h" 11 #include "base/stl_util.h"
11 #include "chrome/browser/download/download_status_updater.h" 12 #include "chrome/browser/download/download_status_updater.h"
12 #include "content/public/test/mock_download_item.h" 13 #include "content/public/test/mock_download_item.h"
13 #include "content/public/test/mock_download_manager.h" 14 #include "content/public/test/mock_download_manager.h"
14 #include "content/public/test/test_browser_thread.h" 15 #include "content/public/test/test_browser_thread.h"
15 #include "testing/gmock/include/gmock/gmock.h" 16 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
17 18
18 using testing::AtLeast; 19 using testing::AtLeast;
19 using testing::Invoke; 20 using testing::Invoke;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 60
60 delete updater_; 61 delete updater_;
61 updater_ = NULL; 62 updater_ = NULL;
62 VerifyAndClearExpectations(); 63 VerifyAndClearExpectations();
63 64
64 managers_.clear(); 65 managers_.clear();
65 for (std::vector<Items>::iterator it = manager_items_.begin(); 66 for (std::vector<Items>::iterator it = manager_items_.begin();
66 it != manager_items_.end(); ++it) 67 it != manager_items_.end(); ++it)
67 STLDeleteContainerPointers(it->begin(), it->end()); 68 STLDeleteContainerPointers(it->begin(), it->end());
68 69
69 loop_.RunUntilIdle(); // Allow DownloadManager destruction. 70 base::RunLoop().RunUntilIdle(); // Allow DownloadManager destruction.
70 } 71 }
71 72
72 protected: 73 protected:
73 // Attach some number of DownloadManagers to the updater. 74 // Attach some number of DownloadManagers to the updater.
74 void SetupManagers(int manager_count) { 75 void SetupManagers(int manager_count) {
75 DCHECK_EQ(0U, managers_.size()); 76 DCHECK_EQ(0U, managers_.size());
76 for (int i = 0; i < manager_count; ++i) { 77 for (int i = 0; i < manager_count; ++i) {
77 content::MockDownloadManager* mgr = 78 content::MockDownloadManager* mgr =
78 new StrictMock<content::MockDownloadManager>; 79 new StrictMock<content::MockDownloadManager>;
79 managers_.push_back(mgr); 80 managers_.push_back(mgr);
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 SetItemValues(0, 0, 10, 20, false); 336 SetItemValues(0, 0, 10, 20, false);
336 SetItemValues(0, 1, 50, 60, false); 337 SetItemValues(0, 1, 50, 60, false);
337 SetItemValues(1, 0, 80, 90, false); 338 SetItemValues(1, 0, 80, 90, false);
338 339
339 float progress = -1; 340 float progress = -1;
340 int download_count = -1; 341 int download_count = -1;
341 EXPECT_TRUE(updater_->GetProgress(&progress, &download_count)); 342 EXPECT_TRUE(updater_->GetProgress(&progress, &download_count));
342 EXPECT_FLOAT_EQ((10+50+80)/(20.0f+60+90), progress); 343 EXPECT_FLOAT_EQ((10+50+80)/(20.0f+60+90), progress);
343 EXPECT_EQ(3, download_count); 344 EXPECT_EQ(3, download_count);
344 } 345 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698