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

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

Issue 10915180: Make DownloadHistory observe manager, items (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 2 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 | Annotate | Revision Log
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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/memory/weak_ptr.h" 6 #include "base/memory/weak_ptr.h"
7 #include "base/message_loop.h" 7 #include "base/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"
11 #include "content/public/test/mock_download_manager.h" 11 #include "content/public/test/mock_download_manager.h"
12 #include "content/public/test/test_browser_thread.h" 12 #include "content/public/test/test_browser_thread.h"
13 #include "testing/gmock/include/gmock/gmock.h" 13 #include "testing/gmock/include/gmock/gmock.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 using ::testing::AtLeast; 16 using testing::AtLeast;
17 using ::testing::Invoke; 17 using testing::Invoke;
18 using ::testing::Mock; 18 using testing::Mock;
19 using ::testing::Return; 19 using testing::Return;
20 using ::testing::SetArgPointee; 20 using testing::SetArgPointee;
21 using ::testing::StrictMock; 21 using testing::StrictMock;
22 using ::testing::WithArg; 22 using testing::WithArg;
23 using ::testing::_; 23 using testing::_;
Randy Smith (Not in Mondays) 2012/09/24 18:03:25 Why in this CL? I don't majorly object, just seem
benjhayden 2012/09/24 20:12:11 I was working with gmock in DownloadHistoryTest an
24 24
25 class TestDownloadStatusUpdater : public DownloadStatusUpdater { 25 class TestDownloadStatusUpdater : public DownloadStatusUpdater {
26 public: 26 public:
27 TestDownloadStatusUpdater() : notification_count_(0), 27 TestDownloadStatusUpdater() : notification_count_(0),
28 acceptable_notification_item_(NULL) { 28 acceptable_notification_item_(NULL) {
29 } 29 }
30 void SetAcceptableNotificationItem(content::DownloadItem* item) { 30 void SetAcceptableNotificationItem(content::DownloadItem* item) {
31 acceptable_notification_item_ = item; 31 acceptable_notification_item_ = item;
32 } 32 }
33 size_t NotificationCount() { 33 size_t NotificationCount() {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 SetItemValues(0, 0, 10, 20, false); 338 SetItemValues(0, 0, 10, 20, false);
339 SetItemValues(0, 1, 50, 60, false); 339 SetItemValues(0, 1, 50, 60, false);
340 SetItemValues(1, 0, 80, 90, false); 340 SetItemValues(1, 0, 80, 90, false);
341 341
342 float progress = -1; 342 float progress = -1;
343 int download_count = -1; 343 int download_count = -1;
344 EXPECT_TRUE(updater_->GetProgress(&progress, &download_count)); 344 EXPECT_TRUE(updater_->GetProgress(&progress, &download_count));
345 EXPECT_FLOAT_EQ((10+50+80)/(20.0f+60+90), progress); 345 EXPECT_FLOAT_EQ((10+50+80)/(20.0f+60+90), progress);
346 EXPECT_EQ(3, download_count); 346 EXPECT_EQ(3, download_count);
347 } 347 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698