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_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/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 | 16 |
17 using ::testing::AtLeast; | 17 using ::testing::AtLeast; |
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::_; | 22 using ::testing::_; |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 SetItemValues(0, 0, 10, 20); | 279 SetItemValues(0, 0, 10, 20); |
280 SetItemValues(0, 1, 50, 60); | 280 SetItemValues(0, 1, 50, 60); |
281 SetItemValues(1, 0, 80, 90); | 281 SetItemValues(1, 0, 80, 90); |
282 | 282 |
283 float progress = -1; | 283 float progress = -1; |
284 int download_count = -1; | 284 int download_count = -1; |
285 EXPECT_TRUE(updater_->GetProgress(&progress, &download_count)); | 285 EXPECT_TRUE(updater_->GetProgress(&progress, &download_count)); |
286 EXPECT_FLOAT_EQ((10+50+80)/(20.0f+60+90), progress); | 286 EXPECT_FLOAT_EQ((10+50+80)/(20.0f+60+90), progress); |
287 EXPECT_EQ(3, download_count); | 287 EXPECT_EQ(3, download_count); |
288 } | 288 } |
OLD | NEW |