| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/download/download_status_updater.h" | 7 #include "content/browser/download/download_status_updater.h" |
| 8 #include "chrome/browser/download/download_status_updater_delegate.h" | 8 #include "content/browser/download/download_status_updater_delegate.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace { | 11 namespace { |
| 12 | 12 |
| 13 class MockDelegate : public DownloadStatusUpdaterDelegate { | 13 class MockDelegate : public DownloadStatusUpdaterDelegate { |
| 14 public: | 14 public: |
| 15 explicit MockDelegate(DownloadStatusUpdater* updater) | 15 explicit MockDelegate(DownloadStatusUpdater* updater) |
| 16 : updater_(updater->AsWeakPtr()), | 16 : updater_(updater->AsWeakPtr()), |
| 17 is_download_progress_known_(true), | 17 is_download_progress_known_(true), |
| 18 in_progress_download_count_(0), | 18 in_progress_download_count_(0), |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 155 |
| 156 delegate1.reset(); | 156 delegate1.reset(); |
| 157 | 157 |
| 158 { | 158 { |
| 159 float progress = -1; | 159 float progress = -1; |
| 160 EXPECT_TRUE(updater_.GetProgress(&progress)); | 160 EXPECT_TRUE(updater_.GetProgress(&progress)); |
| 161 EXPECT_FLOAT_EQ(static_cast<float>(1) / 3, progress); | 161 EXPECT_FLOAT_EQ(static_cast<float>(1) / 3, progress); |
| 162 EXPECT_EQ(2, updater_.GetInProgressDownloadCount()); | 162 EXPECT_EQ(2, updater_.GetInProgressDownloadCount()); |
| 163 } | 163 } |
| 164 } | 164 } |
| OLD | NEW |