| 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/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/download/download_item_model.h" | 10 #include "chrome/browser/download/download_item_model.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 return download_item_.get(); | 41 return download_item_.get(); |
| 42 } | 42 } |
| 43 content::MockDownloadManager* download_manager() { | 43 content::MockDownloadManager* download_manager() { |
| 44 return download_manager_.get(); | 44 return download_manager_.get(); |
| 45 } | 45 } |
| 46 TestDownloadShelf* shelf() { | 46 TestDownloadShelf* shelf() { |
| 47 return &shelf_; | 47 return &shelf_; |
| 48 } | 48 } |
| 49 Profile* profile() { return profile_.get(); } | 49 Profile* profile() { return profile_.get(); } |
| 50 | 50 |
| 51 virtual void SetUp() OVERRIDE { | 51 virtual void SetUp() override { |
| 52 DownloadServiceFactory::GetInstance()->SetTestingFactory( | 52 DownloadServiceFactory::GetInstance()->SetTestingFactory( |
| 53 profile(), &CreateDownloadService); | 53 profile(), &CreateDownloadService); |
| 54 } | 54 } |
| 55 | 55 |
| 56 virtual void TearDown() OVERRIDE { | 56 virtual void TearDown() override { |
| 57 DownloadServiceFactory::GetInstance()->SetTestingFactory( | 57 DownloadServiceFactory::GetInstance()->SetTestingFactory( |
| 58 profile(), NULL); | 58 profile(), NULL); |
| 59 } | 59 } |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 scoped_ptr<content::MockDownloadItem> GetInProgressMockDownload(); | 62 scoped_ptr<content::MockDownloadItem> GetInProgressMockDownload(); |
| 63 | 63 |
| 64 base::MessageLoopForUI message_loop_; | 64 base::MessageLoopForUI message_loop_; |
| 65 content::TestBrowserThread ui_thread_; | 65 content::TestBrowserThread ui_thread_; |
| 66 scoped_ptr<content::MockDownloadItem> download_item_; | 66 scoped_ptr<content::MockDownloadItem> download_item_; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 .WillRepeatedly(Return(false)); | 206 .WillRepeatedly(Return(false)); |
| 207 ASSERT_FALSE(DownloadItemModel(download_item()) | 207 ASSERT_FALSE(DownloadItemModel(download_item()) |
| 208 .ShouldRemoveFromShelfWhenComplete()); | 208 .ShouldRemoveFromShelfWhenComplete()); |
| 209 | 209 |
| 210 base::RunLoop run_loop; | 210 base::RunLoop run_loop; |
| 211 run_loop.RunUntilIdle(); | 211 run_loop.RunUntilIdle(); |
| 212 | 212 |
| 213 EXPECT_TRUE(shelf()->did_add_download()); | 213 EXPECT_TRUE(shelf()->did_add_download()); |
| 214 EXPECT_TRUE(shelf()->IsShowing()); | 214 EXPECT_TRUE(shelf()->IsShowing()); |
| 215 } | 215 } |
| OLD | NEW |