| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #import "chrome/browser/ui/cocoa/download/download_item_controller.h" | 5 #import "chrome/browser/ui/cocoa/download/download_item_controller.h" |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } | 97 } |
| 98 } | 98 } |
| 99 | 99 |
| 100 protected: | 100 protected: |
| 101 std::unique_ptr<content::MockDownloadItem> download_item_; | 101 std::unique_ptr<content::MockDownloadItem> download_item_; |
| 102 base::scoped_nsobject<DownloadShelfController> shelf_; | 102 base::scoped_nsobject<DownloadShelfController> shelf_; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 TEST_F(DownloadItemControllerTest, ShelfNotifiedOfOpenedDownload) { | 105 TEST_F(DownloadItemControllerTest, ShelfNotifiedOfOpenedDownload) { |
| 106 base::scoped_nsobject<DownloadItemController> item(CreateItemController()); | 106 base::scoped_nsobject<DownloadItemController> item(CreateItemController()); |
| 107 [[(id)shelf_ expect] downloadWasOpened:[OCMArg any]]; | 107 [[(id)shelf_ expect] downloadWasOpenedOrShown:[OCMArg any]]; |
| 108 download_item_->NotifyObserversDownloadOpened(); | 108 download_item_->NotifyObserversDownloadOpened(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 TEST_F(DownloadItemControllerTest, ShelfNotifiedOfShownDownload) { |
| 112 base::scoped_nsobject<DownloadItemController> item(CreateItemController()); |
| 113 [[(id)shelf_ expect] downloadWasOpenedOrShown:[OCMArg any]]; |
| 114 download_item_->NotifyObserversDownloadShown(); |
| 115 } |
| 116 |
| 111 TEST_F(DownloadItemControllerTest, RemovesSelfWhenDownloadIsDestroyed) { | 117 TEST_F(DownloadItemControllerTest, RemovesSelfWhenDownloadIsDestroyed) { |
| 112 base::scoped_nsobject<DownloadItemController> item(CreateItemController()); | 118 base::scoped_nsobject<DownloadItemController> item(CreateItemController()); |
| 113 [[(id)shelf_ expect] remove:[OCMArg any]]; | 119 [[(id)shelf_ expect] remove:[OCMArg any]]; |
| 114 download_item_.reset(); | 120 download_item_.reset(); |
| 115 } | 121 } |
| 116 | 122 |
| 117 TEST_F(DownloadItemControllerTest, NormalDownload) { | 123 TEST_F(DownloadItemControllerTest, NormalDownload) { |
| 118 base::scoped_nsobject<DownloadItemController> item(CreateItemController()); | 124 base::scoped_nsobject<DownloadItemController> item(CreateItemController()); |
| 119 | 125 |
| 120 [item verifyProgressViewIsVisible:true]; | 126 [item verifyProgressViewIsVisible:true]; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 // download item are mock objects. | 188 // download item are mock objects. |
| 183 [downloadItemButton removeFromSuperview]; | 189 [downloadItemButton removeFromSuperview]; |
| 184 }]; | 190 }]; |
| 185 // The unit test will stop here until the block causes the DownloadItemButton | 191 // The unit test will stop here until the block causes the DownloadItemButton |
| 186 // to dismiss the menu. | 192 // to dismiss the menu. |
| 187 [item showContextMenu:nil]; | 193 [item showContextMenu:nil]; |
| 188 } | 194 } |
| 189 | 195 |
| 190 | 196 |
| 191 } // namespace | 197 } // namespace |
| OLD | NEW |