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

Side by Side Diff: chrome/browser/cocoa/bookmark_bar_controller_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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/scoped_nsobject.h" 8 #include "base/scoped_nsobject.h"
9 #import "chrome/browser/cocoa/bookmark_bar_controller.h" 9 #import "chrome/browser/cocoa/bookmark_bar_controller.h"
10 #include "chrome/browser/cocoa/browser_test_helper.h" 10 #include "chrome/browser/cocoa/browser_test_helper.h"
11 #import "chrome/browser/cocoa/cocoa_test_helper.h" 11 #import "chrome/browser/cocoa/cocoa_test_helper.h"
12 #include "chrome/browser/cocoa/test_event_utils.h" 12 #include "chrome/browser/cocoa/test_event_utils.h"
13 #import "chrome/browser/cocoa/view_resizer_pong.h" 13 #import "chrome/browser/cocoa/view_resizer_pong.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 #include "testing/platform_test.h"
15 16
16 // Pretend BookmarkURLOpener delegate to keep track of requests 17 // Pretend BookmarkURLOpener delegate to keep track of requests
17 @interface BookmarkURLOpenerPong : NSObject<BookmarkURLOpener> { 18 @interface BookmarkURLOpenerPong : NSObject<BookmarkURLOpener> {
18 @public 19 @public
19 std::vector<GURL> urls_; 20 std::vector<GURL> urls_;
20 std::vector<WindowOpenDisposition> dispositions_; 21 std::vector<WindowOpenDisposition> dispositions_;
21 } 22 }
22 @end 23 @end
23 24
24 @implementation BookmarkURLOpenerPong 25 @implementation BookmarkURLOpenerPong
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 74 }
74 75
75 @end 76 @end
76 77
77 78
78 namespace { 79 namespace {
79 80
80 static const int kContentAreaHeight = 500; 81 static const int kContentAreaHeight = 500;
81 static const int kInfoBarViewHeight = 30; 82 static const int kInfoBarViewHeight = 30;
82 83
83 class BookmarkBarControllerTest : public testing::Test { 84 class BookmarkBarControllerTest : public PlatformTest {
84 public: 85 public:
85 BookmarkBarControllerTest() { 86 BookmarkBarControllerTest() {
86 resizeDelegate_.reset([[ViewResizerPong alloc] init]); 87 resizeDelegate_.reset([[ViewResizerPong alloc] init]);
87 NSRect parent_frame = NSMakeRect(0, 0, 800, 50); 88 NSRect parent_frame = NSMakeRect(0, 0, 800, 50);
88 parent_view_.reset([[NSView alloc] initWithFrame:parent_frame]); 89 parent_view_.reset([[NSView alloc] initWithFrame:parent_frame]);
89 [parent_view_ setHidden:YES]; 90 [parent_view_ setHidden:YES];
90 bar_.reset( 91 bar_.reset(
91 [[BookmarkBarController alloc] initWithProfile:helper_.profile() 92 [[BookmarkBarController alloc] initWithProfile:helper_.profile()
92 initialWidth:NSWidth(parent_frame) 93 initialWidth:NSWidth(parent_frame)
93 resizeDelegate:resizeDelegate_.get() 94 resizeDelegate:resizeDelegate_.get()
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 EXPECT_EQ(pong.get()->urls_.size(), 1U); 523 EXPECT_EQ(pong.get()->urls_.size(), 1U);
523 [bar_ setUrlDelegate:nil]; 524 [bar_ setUrlDelegate:nil];
524 } 525 }
525 526
526 // Cannot test these methods since they simply call a single static 527 // Cannot test these methods since they simply call a single static
527 // method, BookmarkEditor::Show(), which is impossible to mock. 528 // method, BookmarkEditor::Show(), which is impossible to mock.
528 // editBookmark:, addPage: 529 // editBookmark:, addPage:
529 530
530 531
531 } // namespace 532 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698