OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/callback.h" | 6 #include "base/callback.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 EXPECT_CALL(*manager_, | 168 EXPECT_CALL(*manager_, |
169 RemoveObserver(testing::Eq( | 169 RemoveObserver(testing::Eq( |
170 testing::ByRef(download_history_manager_observer_)))) | 170 testing::ByRef(download_history_manager_observer_)))) |
171 .WillOnce(testing::Assign( | 171 .WillOnce(testing::Assign( |
172 &download_history_manager_observer_, | 172 &download_history_manager_observer_, |
173 static_cast<content::DownloadManager::Observer*>(NULL))); | 173 static_cast<content::DownloadManager::Observer*>(NULL))); |
174 EXPECT_CALL(*manager_, GetAllDownloads(_)).Times(AnyNumber()); | 174 EXPECT_CALL(*manager_, GetAllDownloads(_)).Times(AnyNumber()); |
175 | 175 |
176 scoped_ptr<HistoryAdapter> history_adapter(new HistoryAdapter); | 176 scoped_ptr<HistoryAdapter> history_adapter(new HistoryAdapter); |
177 history_adapter_ = history_adapter.get(); | 177 history_adapter_ = history_adapter.get(); |
178 scoped_ptr<DownloadHistory> download_history(new DownloadHistory( | 178 scoped_ptr<DownloadHistory> download_history( |
179 manager_.get(), | 179 new DownloadHistory(manager_.get(), history_adapter.Pass())); |
180 history_adapter.PassAs<DownloadHistory::HistoryAdapter>())); | |
181 ASSERT_TRUE(download_history_manager_observer_); | 180 ASSERT_TRUE(download_history_manager_observer_); |
182 | 181 |
183 EXPECT_CALL(*manager_, AddObserver(_)) | 182 EXPECT_CALL(*manager_, AddObserver(_)) |
184 .WillOnce(SaveArg<0>(&manager_observer_)); | 183 .WillOnce(SaveArg<0>(&manager_observer_)); |
185 EXPECT_CALL(*manager_, | 184 EXPECT_CALL(*manager_, |
186 RemoveObserver(testing::Eq(testing::ByRef(manager_observer_)))) | 185 RemoveObserver(testing::Eq(testing::ByRef(manager_observer_)))) |
187 .WillOnce(testing::Assign( | 186 .WillOnce(testing::Assign( |
188 &manager_observer_, | 187 &manager_observer_, |
189 static_cast<content::DownloadManager::Observer*>(NULL))); | 188 static_cast<content::DownloadManager::Observer*>(NULL))); |
190 TestDownloadService* download_service = static_cast<TestDownloadService*>( | 189 TestDownloadService* download_service = static_cast<TestDownloadService*>( |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 // DownloadUIController. It should ignore the download since it's marked as | 337 // DownloadUIController. It should ignore the download since it's marked as |
339 // being restored from history. | 338 // being restored from history. |
340 ASSERT_TRUE(manager_observer()); | 339 ASSERT_TRUE(manager_observer()); |
341 manager_observer()->OnDownloadCreated(manager(), item.get()); | 340 manager_observer()->OnDownloadCreated(manager(), item.get()); |
342 | 341 |
343 // Finally, the expectation we've been waiting for: | 342 // Finally, the expectation we've been waiting for: |
344 EXPECT_FALSE(notified_item()); | 343 EXPECT_FALSE(notified_item()); |
345 } | 344 } |
346 | 345 |
347 } // namespace | 346 } // namespace |
OLD | NEW |