| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/cocoa/browser_test_helper.h" | 5 #include "chrome/browser/cocoa/browser_test_helper.h" |
| 6 #include "chrome/browser/cocoa/cocoa_test_helper.h" | 6 #include "chrome/browser/cocoa/cocoa_test_helper.h" |
| 7 #include "chrome/browser/cocoa/download_shelf_mac.h" | 7 #include "chrome/browser/cocoa/download_shelf_mac.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 | 9 |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 virtual void SetUp() { | 50 virtual void SetUp() { |
| 51 shelf_controller_.reset([[FakeDownloadShelfController alloc] init]); | 51 shelf_controller_.reset([[FakeDownloadShelfController alloc] init]); |
| 52 } | 52 } |
| 53 | 53 |
| 54 protected: | 54 protected: |
| 55 scoped_nsobject<FakeDownloadShelfController> shelf_controller_; | 55 scoped_nsobject<FakeDownloadShelfController> shelf_controller_; |
| 56 CocoaTestHelper helper_; | 56 CocoaTestHelper helper_; |
| 57 BrowserTestHelper browser_helper_; | 57 BrowserTestHelper browser_helper_; |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 TEST_F(DownloadShelfMacTest, CreationCallsShow) { | 60 TEST_F(DownloadShelfMacTest, CreationDoesNotCallShow) { |
| 61 // Also make sure the DownloadShelfMacTest constructor doesn't crash. | 61 // Also make sure the DownloadShelfMacTest constructor doesn't crash. |
| 62 DownloadShelfMac shelf(browser_helper_.browser(), | 62 DownloadShelfMac shelf(browser_helper_.browser(), |
| 63 (DownloadShelfController*)shelf_controller_.get()); | 63 (DownloadShelfController*)shelf_controller_.get()); |
| 64 EXPECT_EQ(1, shelf_controller_.get()->callCountShow); | 64 EXPECT_EQ(0, shelf_controller_.get()->callCountShow); |
| 65 } | 65 } |
| 66 | 66 |
| 67 TEST_F(DownloadShelfMacTest, ForwardsShow) { | 67 TEST_F(DownloadShelfMacTest, ForwardsShow) { |
| 68 DownloadShelfMac shelf(browser_helper_.browser(), | 68 DownloadShelfMac shelf(browser_helper_.browser(), |
| 69 (DownloadShelfController*)shelf_controller_.get()); | 69 (DownloadShelfController*)shelf_controller_.get()); |
| 70 EXPECT_EQ(0, shelf_controller_.get()->callCountShow); |
| 71 shelf.Show(); |
| 70 EXPECT_EQ(1, shelf_controller_.get()->callCountShow); | 72 EXPECT_EQ(1, shelf_controller_.get()->callCountShow); |
| 71 shelf.Show(); | |
| 72 EXPECT_EQ(2, shelf_controller_.get()->callCountShow); | |
| 73 } | 73 } |
| 74 | 74 |
| 75 TEST_F(DownloadShelfMacTest, ForwardsHide) { | 75 TEST_F(DownloadShelfMacTest, ForwardsHide) { |
| 76 DownloadShelfMac shelf(browser_helper_.browser(), | 76 DownloadShelfMac shelf(browser_helper_.browser(), |
| 77 (DownloadShelfController*)shelf_controller_.get()); | 77 (DownloadShelfController*)shelf_controller_.get()); |
| 78 EXPECT_EQ(0, shelf_controller_.get()->callCountHide); | 78 EXPECT_EQ(0, shelf_controller_.get()->callCountHide); |
| 79 shelf.Close(); | 79 shelf.Close(); |
| 80 EXPECT_EQ(1, shelf_controller_.get()->callCountHide); | 80 EXPECT_EQ(1, shelf_controller_.get()->callCountHide); |
| 81 } | 81 } |
| 82 | 82 |
| 83 TEST_F(DownloadShelfMacTest, ForwardsIsShowing) { | 83 TEST_F(DownloadShelfMacTest, ForwardsIsShowing) { |
| 84 DownloadShelfMac shelf(browser_helper_.browser(), | 84 DownloadShelfMac shelf(browser_helper_.browser(), |
| 85 (DownloadShelfController*)shelf_controller_.get()); | 85 (DownloadShelfController*)shelf_controller_.get()); |
| 86 EXPECT_EQ(0, shelf_controller_.get()->callCountIsVisible); | 86 EXPECT_EQ(0, shelf_controller_.get()->callCountIsVisible); |
| 87 shelf.IsShowing(); | 87 shelf.IsShowing(); |
| 88 EXPECT_EQ(1, shelf_controller_.get()->callCountIsVisible); | 88 EXPECT_EQ(1, shelf_controller_.get()->callCountIsVisible); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace | 91 } // namespace |
| OLD | NEW |