| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/memory/scoped_nsobject.h" | 5 #import "base/mac/scoped_nsobject.h" |
| 6 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" | 6 #include "chrome/browser/ui/cocoa/cocoa_profile_test.h" |
| 7 #include "chrome/browser/ui/cocoa/download/download_shelf_mac.h" | 7 #include "chrome/browser/ui/cocoa/download/download_shelf_mac.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "testing/platform_test.h" | 9 #include "testing/platform_test.h" |
| 10 | 10 |
| 11 // A fake implementation of DownloadShelfController. It implements only the | 11 // A fake implementation of DownloadShelfController. It implements only the |
| 12 // methods that DownloadShelfMac call during the tests in this file. We get this | 12 // methods that DownloadShelfMac call during the tests in this file. We get this |
| 13 // class into the DownloadShelfMac constructor by some questionable casting -- | 13 // class into the DownloadShelfMac constructor by some questionable casting -- |
| 14 // Objective C is a dynamic language, so we pretend that's ok. | 14 // Objective C is a dynamic language, so we pretend that's ok. |
| 15 | 15 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 namespace { | 49 namespace { |
| 50 | 50 |
| 51 class DownloadShelfMacTest : public CocoaProfileTest { | 51 class DownloadShelfMacTest : public CocoaProfileTest { |
| 52 | 52 |
| 53 virtual void SetUp() { | 53 virtual void SetUp() { |
| 54 CocoaProfileTest::SetUp(); | 54 CocoaProfileTest::SetUp(); |
| 55 shelf_controller_.reset([[FakeDownloadShelfController alloc] init]); | 55 shelf_controller_.reset([[FakeDownloadShelfController alloc] init]); |
| 56 } | 56 } |
| 57 | 57 |
| 58 protected: | 58 protected: |
| 59 scoped_nsobject<FakeDownloadShelfController> shelf_controller_; | 59 base::scoped_nsobject<FakeDownloadShelfController> shelf_controller_; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 TEST_F(DownloadShelfMacTest, CreationDoesNotCallShow) { | 62 TEST_F(DownloadShelfMacTest, CreationDoesNotCallShow) { |
| 63 // Also make sure the DownloadShelfMacTest constructor doesn't crash. | 63 // Also make sure the DownloadShelfMacTest constructor doesn't crash. |
| 64 DownloadShelfMac shelf(browser(), | 64 DownloadShelfMac shelf(browser(), |
| 65 (DownloadShelfController*)shelf_controller_.get()); | 65 (DownloadShelfController*)shelf_controller_.get()); |
| 66 EXPECT_EQ(0, shelf_controller_.get()->callCountShow); | 66 EXPECT_EQ(0, shelf_controller_.get()->callCountShow); |
| 67 } | 67 } |
| 68 | 68 |
| 69 TEST_F(DownloadShelfMacTest, ForwardsShow) { | 69 TEST_F(DownloadShelfMacTest, ForwardsShow) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 94 | 94 |
| 95 TEST_F(DownloadShelfMacTest, ForwardsIsShowing) { | 95 TEST_F(DownloadShelfMacTest, ForwardsIsShowing) { |
| 96 DownloadShelfMac shelf(browser(), | 96 DownloadShelfMac shelf(browser(), |
| 97 (DownloadShelfController*)shelf_controller_.get()); | 97 (DownloadShelfController*)shelf_controller_.get()); |
| 98 EXPECT_EQ(0, shelf_controller_.get()->callCountIsVisible); | 98 EXPECT_EQ(0, shelf_controller_.get()->callCountIsVisible); |
| 99 shelf.IsShowing(); | 99 shelf.IsShowing(); |
| 100 EXPECT_EQ(1, shelf_controller_.get()->callCountIsVisible); | 100 EXPECT_EQ(1, shelf_controller_.get()->callCountIsVisible); |
| 101 } | 101 } |
| 102 | 102 |
| 103 } // namespace | 103 } // namespace |
| OLD | NEW |