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

Side by Side Diff: chrome/browser/cocoa/bookmark_bar_bridge_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/bookmark_bar_bridge.h" 5 #include "chrome/browser/cocoa/bookmark_bar_bridge.h"
6 #include "chrome/browser/cocoa/bookmark_bar_controller.h" 6 #include "chrome/browser/cocoa/bookmark_bar_controller.h"
7 #include "chrome/browser/cocoa/browser_test_helper.h" 7 #include "chrome/browser/cocoa/browser_test_helper.h"
8 #include "chrome/browser/cocoa/cocoa_test_helper.h" 8 #include "chrome/browser/cocoa/cocoa_test_helper.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "testing/platform_test.h"
10 11
11 // TODO(jrg): add OCMock to Chromium to save some typing. 12 // TODO(jrg): add OCMock to Chromium to save some typing.
12 13
13 namespace { 14 namespace {
14 15
15 // Information needed to open a URL, as passed to the 16 // Information needed to open a URL, as passed to the
16 // BookmarkBarController's delegate. 17 // BookmarkBarController's delegate.
17 typedef std::pair<GURL,WindowOpenDisposition> OpenInfo; 18 typedef std::pair<GURL,WindowOpenDisposition> OpenInfo;
18 19
19 } // The namespace must end here -- I need to use OpenInfo in 20 } // The namespace must end here -- I need to use OpenInfo in
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 84
84 // Save the request. 85 // Save the request.
85 - (void)openBookmarkURL:(const GURL&)url 86 - (void)openBookmarkURL:(const GURL&)url
86 disposition:(WindowOpenDisposition)disposition { 87 disposition:(WindowOpenDisposition)disposition {
87 opens_.push_back(OpenInfo(url, disposition)); 88 opens_.push_back(OpenInfo(url, disposition));
88 } 89 }
89 90
90 @end 91 @end
91 92
92 93
93 class BookmarkBarBridgeTest : public testing::Test { 94 class BookmarkBarBridgeTest : public PlatformTest {
94 public: 95 public:
95 CocoaTestHelper cocoa_helper_; 96 CocoaTestHelper cocoa_helper_;
96 BrowserTestHelper browser_test_helper_; 97 BrowserTestHelper browser_test_helper_;
97 }; 98 };
98 99
99 // Call all the callbacks; make sure they are all redirected to the objc object. 100 // Call all the callbacks; make sure they are all redirected to the objc object.
100 TEST_F(BookmarkBarBridgeTest, TestRedirect) { 101 TEST_F(BookmarkBarBridgeTest, TestRedirect) {
101 Profile *profile = browser_test_helper_.profile(); 102 Profile *profile = browser_test_helper_.profile();
102 BookmarkModel *model = profile->GetBookmarkModel(); 103 BookmarkModel *model = profile->GetBookmarkModel();
103 104
(...skipping 21 matching lines...) Expand all
125 bridge->BookmarkNodeRemoved(NULL, NULL, 0, NULL); 126 bridge->BookmarkNodeRemoved(NULL, NULL, 0, NULL);
126 127
127 // 8 calls above plus an initial Loaded() in init routine makes 9 128 // 8 calls above plus an initial Loaded() in init routine makes 9
128 EXPECT_TRUE([controller.get()->callbacks_ count] == 9); 129 EXPECT_TRUE([controller.get()->callbacks_ count] == 9);
129 130
130 for (int x = 1; x < 9; x++) { 131 for (int x = 1; x < 9; x++) {
131 NSNumber *num = [NSNumber numberWithInt:x-1]; 132 NSNumber *num = [NSNumber numberWithInt:x-1];
132 EXPECT_TRUE([[controller.get()->callbacks_ objectAtIndex:x] isEqual:num]); 133 EXPECT_TRUE([[controller.get()->callbacks_ objectAtIndex:x] isEqual:num]);
133 } 134 }
134 } 135 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698