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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/stl_util.h" | 6 #include "base/stl_util.h" |
7 #include "base/threading/thread.h" | 7 #include "base/threading/thread.h" |
8 #include "content/browser/download/byte_stream.h" | 8 #include "content/browser/download/byte_stream.h" |
9 #include "content/browser/download/download_create_info.h" | 9 #include "content/browser/download/download_create_info.h" |
10 #include "content/browser/download/download_file_factory.h" | 10 #include "content/browser/download/download_file_factory.h" |
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 EXPECT_TRUE(observer.CheckUpdated()); | 394 EXPECT_TRUE(observer.CheckUpdated()); |
395 EXPECT_EQ(new_intermediate_path, item->GetFullPath()); | 395 EXPECT_EQ(new_intermediate_path, item->GetFullPath()); |
396 | 396 |
397 CleanupItem(item, download_file); | 397 CleanupItem(item, download_file); |
398 } | 398 } |
399 | 399 |
400 TEST_F(DownloadItemTest, NotificationAfterTogglePause) { | 400 TEST_F(DownloadItemTest, NotificationAfterTogglePause) { |
401 DownloadItemImpl* item = CreateDownloadItem(DownloadItem::IN_PROGRESS); | 401 DownloadItemImpl* item = CreateDownloadItem(DownloadItem::IN_PROGRESS); |
402 MockObserver observer(item); | 402 MockObserver observer(item); |
403 | 403 |
404 item->TogglePause(); | 404 item->Pause(); |
405 ASSERT_TRUE(observer.CheckUpdated()); | 405 ASSERT_TRUE(observer.CheckUpdated()); |
406 | 406 |
407 item->TogglePause(); | 407 ASSERT_TRUE(item->IsPaused()); |
| 408 |
| 409 item->Resume(); |
408 ASSERT_TRUE(observer.CheckUpdated()); | 410 ASSERT_TRUE(observer.CheckUpdated()); |
409 } | 411 } |
410 | 412 |
411 TEST_F(DownloadItemTest, DisplayName) { | 413 TEST_F(DownloadItemTest, DisplayName) { |
412 DownloadItemImpl* item = CreateDownloadItem(DownloadItem::IN_PROGRESS); | 414 DownloadItemImpl* item = CreateDownloadItem(DownloadItem::IN_PROGRESS); |
413 DownloadItemImplDelegate::DownloadTargetCallback callback; | 415 DownloadItemImplDelegate::DownloadTargetCallback callback; |
414 MockDownloadFile* download_file = | 416 MockDownloadFile* download_file = |
415 AddDownloadFileToDownloadItem(item, &callback); | 417 AddDownloadFileToDownloadItem(item, &callback); |
416 FilePath target_path(FilePath(kDummyPath).AppendASCII("foo.bar")); | 418 FilePath target_path(FilePath(kDummyPath).AppendASCII("foo.bar")); |
417 FilePath intermediate_path(target_path.InsertBeforeExtensionASCII("x")); | 419 FilePath intermediate_path(target_path.InsertBeforeExtensionASCII("x")); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 EXPECT_EQ("livebeef", item->GetHash()); | 619 EXPECT_EQ("livebeef", item->GetHash()); |
618 EXPECT_EQ("", item->GetHashState()); | 620 EXPECT_EQ("", item->GetHashState()); |
619 EXPECT_TRUE(item->AllDataSaved()); | 621 EXPECT_TRUE(item->AllDataSaved()); |
620 } | 622 } |
621 | 623 |
622 TEST(MockDownloadItem, Compiles) { | 624 TEST(MockDownloadItem, Compiles) { |
623 MockDownloadItem mock_item; | 625 MockDownloadItem mock_item; |
624 } | 626 } |
625 | 627 |
626 } // namespace content | 628 } // namespace content |
OLD | NEW |