| 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 "chrome/browser/download/all_download_item_notifier.h" | 5 #include "chrome/browser/download/all_download_item_notifier.h" |
| 6 | 6 |
| 7 #include "content/public/test/mock_download_item.h" | 7 #include "content/public/test/mock_download_item.h" |
| 8 #include "content/public/test/mock_download_manager.h" | 8 #include "content/public/test/mock_download_manager.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 notifier_.reset(new AllDownloadItemNotifier( | 63 notifier_.reset(new AllDownloadItemNotifier( |
| 64 download_manager_.get(), &observer_)); | 64 download_manager_.get(), &observer_)); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void ClearNotifier() { | 67 void ClearNotifier() { |
| 68 notifier_.reset(); | 68 notifier_.reset(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 private: | 71 private: |
| 72 NiceMock<content::MockDownloadItem> item_; | 72 NiceMock<content::MockDownloadItem> item_; |
| 73 scoped_refptr<content::MockDownloadManager> download_manager_; | 73 scoped_ptr<content::MockDownloadManager> download_manager_; |
| 74 scoped_ptr<AllDownloadItemNotifier> notifier_; | 74 scoped_ptr<AllDownloadItemNotifier> notifier_; |
| 75 NiceMock<MockNotifierObserver> observer_; | 75 NiceMock<MockNotifierObserver> observer_; |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(AllDownloadItemNotifierTest); | 77 DISALLOW_COPY_AND_ASSIGN(AllDownloadItemNotifierTest); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 } // namespace | 80 } // namespace |
| 81 | 81 |
| 82 TEST_F(AllDownloadItemNotifierTest, | 82 TEST_F(AllDownloadItemNotifierTest, |
| 83 AllDownloadItemNotifierTest_0) { | 83 AllDownloadItemNotifierTest_0) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 113 &manager(), &item()); | 113 &manager(), &item()); |
| 114 | 114 |
| 115 EXPECT_CALL(manager(), RemoveObserver(NotifierAsManagerObserver())); | 115 EXPECT_CALL(manager(), RemoveObserver(NotifierAsManagerObserver())); |
| 116 NotifierAsManagerObserver()->ManagerGoingDown(&manager()); | 116 NotifierAsManagerObserver()->ManagerGoingDown(&manager()); |
| 117 | 117 |
| 118 EXPECT_CALL(item(), RemoveObserver(NotifierAsItemObserver())); | 118 EXPECT_CALL(item(), RemoveObserver(NotifierAsItemObserver())); |
| 119 NotifierAsItemObserver()->OnDownloadDestroyed(&item()); | 119 NotifierAsItemObserver()->OnDownloadDestroyed(&item()); |
| 120 | 120 |
| 121 ClearNotifier(); | 121 ClearNotifier(); |
| 122 } | 122 } |
| OLD | NEW |