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

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

Issue 402066: Moved a whole pile of unittests over to CocoaTest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 "chrome/browser/cocoa/cocoa_test_helper.h" 7 #include "chrome/browser/cocoa/cocoa_test_helper.h"
8 #import "chrome/browser/cocoa/infobar_text_field.h" 8 #import "chrome/browser/cocoa/infobar_text_field.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "testing/platform_test.h" 10 #include "testing/platform_test.h"
(...skipping 18 matching lines...) Expand all
29 - (void)linkClicked { 29 - (void)linkClicked {
30 pong_ = YES; 30 pong_ = YES;
31 } 31 }
32 @end 32 @end
33 33
34 namespace { 34 namespace {
35 35
36 /////////////////////////////////////////////////////////////////////////// 36 ///////////////////////////////////////////////////////////////////////////
37 // Test fixtures 37 // Test fixtures
38 38
39 class InfoBarTextFieldTest : public PlatformTest { 39 class InfoBarTextFieldTest : public CocoaTest {
40 protected: 40 public:
41 CocoaTestHelper helper_; 41 InfoBarTextFieldTest() {
42 NSRect frame = NSMakeRect(0, 0, 200, 200);
43 scoped_nsobject<InfoBarTextField> field(
44 [[InfoBarTextField alloc] initWithFrame:frame]);
45 field_ = field.get();
46 [[test_window() contentView] addSubview:field_];
47 }
48
49 InfoBarTextField* field_;
42 }; 50 };
43 51
44 //////////////////////////////////////////////////////////////////////////// 52 ////////////////////////////////////////////////////////////////////////////
45 // Tests 53 // Tests
46 54
47 TEST_F(InfoBarTextFieldTest, Show) { 55 TEST_VIEW(InfoBarTextFieldTest, field_)
48 // Test basic drawing.
49 scoped_nsobject<InfoBarTextField> field(
50 [[InfoBarTextField alloc] initWithFrame:NSMakeRect(0, 0, 200, 200)]);
51 [helper_.contentView() addSubview:field];
52 }
53 56
54 TEST_F(InfoBarTextFieldTest, LinkClicked) { 57 TEST_F(InfoBarTextFieldTest, LinkClicked) {
55 scoped_nsobject<InfoBarTextField> field( 58 scoped_nsobject<InfoBarTextField> field(
56 [[InfoBarTextField alloc] initWithFrame:NSMakeRect(0, 0, 200, 200)]); 59 [[InfoBarTextField alloc] initWithFrame:NSMakeRect(0, 0, 200, 200)]);
57 scoped_nsobject<TextFieldDelegatePong> delegate( 60 scoped_nsobject<TextFieldDelegatePong> delegate(
58 [[TextFieldDelegatePong alloc] init]); 61 [[TextFieldDelegatePong alloc] init]);
59 [field setDelegate:delegate]; 62 [field setDelegate:delegate];
60 63
61 // Our implementation doesn't look at any of these fields, so they 64 // Our implementation doesn't look at any of these fields, so they
62 // can all be nil. 65 // can all be nil.
63 [field textView:nil clickedOnLink:nil atIndex:0]; 66 [field textView:nil clickedOnLink:nil atIndex:0];
64 EXPECT_TRUE([delegate pong]); 67 EXPECT_TRUE([delegate pong]);
65 } 68 }
66 69
67 } // namespace 70 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/infobar_controller_unittest.mm ('k') | chrome/browser/cocoa/keyword_editor_cocoa_controller_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698