| 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/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "chrome/browser/download/download_item_model.h" | 9 #include "chrome/browser/download/download_item_model.h" |
| 10 #include "chrome/browser/download/test_download_shelf.h" | 10 #include "chrome/browser/download/test_download_shelf.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 content::MockDownloadManager* download_manager() { | 33 content::MockDownloadManager* download_manager() { |
| 34 return download_manager_.get(); | 34 return download_manager_.get(); |
| 35 } | 35 } |
| 36 TestDownloadShelf* shelf() { | 36 TestDownloadShelf* shelf() { |
| 37 return &shelf_; | 37 return &shelf_; |
| 38 } | 38 } |
| 39 | 39 |
| 40 private: | 40 private: |
| 41 scoped_ptr<content::MockDownloadItem> GetInProgressMockDownload(); | 41 scoped_ptr<content::MockDownloadItem> GetInProgressMockDownload(); |
| 42 | 42 |
| 43 MessageLoopForUI message_loop_; | 43 base::MessageLoopForUI message_loop_; |
| 44 content::TestBrowserThread ui_thread_; | 44 content::TestBrowserThread ui_thread_; |
| 45 scoped_ptr<content::MockDownloadItem> download_item_; | 45 scoped_ptr<content::MockDownloadItem> download_item_; |
| 46 scoped_refptr<content::MockDownloadManager> download_manager_; | 46 scoped_refptr<content::MockDownloadManager> download_manager_; |
| 47 TestDownloadShelf shelf_; | 47 TestDownloadShelf shelf_; |
| 48 }; | 48 }; |
| 49 | 49 |
| 50 DownloadShelfTest::DownloadShelfTest() | 50 DownloadShelfTest::DownloadShelfTest() |
| 51 : ui_thread_(content::BrowserThread::UI, &message_loop_) { | 51 : ui_thread_(content::BrowserThread::UI, &message_loop_) { |
| 52 download_item_.reset(new ::testing::NiceMock<content::MockDownloadItem>()); | 52 download_item_.reset(new ::testing::NiceMock<content::MockDownloadItem>()); |
| 53 ON_CALL(*download_item_, GetAutoOpened()).WillByDefault(Return(false)); | 53 ON_CALL(*download_item_, GetAutoOpened()).WillByDefault(Return(false)); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 .WillRepeatedly(Return(false)); | 176 .WillRepeatedly(Return(false)); |
| 177 ASSERT_FALSE(DownloadItemModel(download_item()) | 177 ASSERT_FALSE(DownloadItemModel(download_item()) |
| 178 .ShouldRemoveFromShelfWhenComplete()); | 178 .ShouldRemoveFromShelfWhenComplete()); |
| 179 | 179 |
| 180 base::RunLoop run_loop; | 180 base::RunLoop run_loop; |
| 181 run_loop.RunUntilIdle(); | 181 run_loop.RunUntilIdle(); |
| 182 | 182 |
| 183 EXPECT_TRUE(shelf()->did_add_download()); | 183 EXPECT_TRUE(shelf()->did_add_download()); |
| 184 EXPECT_TRUE(shelf()->IsShowing()); | 184 EXPECT_TRUE(shelf()->IsShowing()); |
| 185 } | 185 } |
| OLD | NEW |