Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Side by Side Diff: chrome/browser/cocoa/download_shelf_mac_unittest.mm

Issue 178037: Make all of our unit tests be PlatformTests to get an autorelease pool.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #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
16 @interface FakeDownloadShelfController : NSObject { 16 @interface FakeDownloadShelfController : NSObject {
17 @public 17 @public
18 int callCountIsVisible; 18 int callCountIsVisible;
19 int callCountShow; 19 int callCountShow;
(...skipping 18 matching lines...) Expand all
38 38
39 - (IBAction)hide:(id)sender { 39 - (IBAction)hide:(id)sender {
40 ++callCountHide; 40 ++callCountHide;
41 } 41 }
42 42
43 @end 43 @end
44 44
45 45
46 namespace { 46 namespace {
47 47
48 class DownloadShelfMacTest : public testing::Test { 48 class DownloadShelfMacTest : public PlatformTest {
49 49
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 };
(...skipping 23 matching lines...) Expand all
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698