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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
9 #include "content/browser/byte_stream.h" | 9 #include "content/browser/byte_stream.h" |
10 #include "content/browser/download/download_create_info.h" | 10 #include "content/browser/download/download_create_info.h" |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 // State changing functions not tested: | 337 // State changing functions not tested: |
338 // void OpenDownload(); | 338 // void OpenDownload(); |
339 // void ShowDownloadInShell(); | 339 // void ShowDownloadInShell(); |
340 // void CompleteDelayedDownload(); | 340 // void CompleteDelayedDownload(); |
341 // set_* mutators | 341 // set_* mutators |
342 | 342 |
343 TEST_F(DownloadItemTest, NotificationAfterUpdate) { | 343 TEST_F(DownloadItemTest, NotificationAfterUpdate) { |
344 DownloadItemImpl* item = CreateDownloadItem(); | 344 DownloadItemImpl* item = CreateDownloadItem(); |
345 MockObserver observer(item); | 345 MockObserver observer(item); |
346 | 346 |
347 item->UpdateProgress(kDownloadChunkSize, kDownloadSpeed, std::string()); | 347 item->DestinationUpdate(kDownloadChunkSize, kDownloadSpeed, std::string()); |
348 ASSERT_TRUE(observer.CheckUpdated()); | 348 ASSERT_TRUE(observer.CheckUpdated()); |
349 EXPECT_EQ(kDownloadSpeed, item->CurrentSpeed()); | 349 EXPECT_EQ(kDownloadSpeed, item->CurrentSpeed()); |
350 } | 350 } |
351 | 351 |
352 TEST_F(DownloadItemTest, NotificationAfterCancel) { | 352 TEST_F(DownloadItemTest, NotificationAfterCancel) { |
353 DownloadItemImpl* user_cancel = CreateDownloadItem(); | 353 DownloadItemImpl* user_cancel = CreateDownloadItem(); |
354 MockDownloadFile* download_file = | 354 MockDownloadFile* download_file = |
355 AddDownloadFileToDownloadItem(user_cancel, NULL); | 355 AddDownloadFileToDownloadItem(user_cancel, NULL); |
356 EXPECT_CALL(*download_file, Cancel()); | 356 EXPECT_CALL(*download_file, Cancel()); |
357 MockObserver observer1(user_cancel); | 357 MockObserver observer1(user_cancel); |
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 EXPECT_CALL(*download_file, Detach()); | 1103 EXPECT_CALL(*download_file, Detach()); |
1104 RunAllPendingInMessageLoops(); | 1104 RunAllPendingInMessageLoops(); |
1105 EXPECT_EQ(DownloadItem::COMPLETE, item->GetState()); | 1105 EXPECT_EQ(DownloadItem::COMPLETE, item->GetState()); |
1106 } | 1106 } |
1107 | 1107 |
1108 TEST(MockDownloadItem, Compiles) { | 1108 TEST(MockDownloadItem, Compiles) { |
1109 MockDownloadItem mock_item; | 1109 MockDownloadItem mock_item; |
1110 } | 1110 } |
1111 | 1111 |
1112 } // namespace content | 1112 } // namespace content |
OLD | NEW |