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

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

Issue 155494: First cut at infobars on Mac. These are not expected to be... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 5 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
« no previous file with comments | « chrome/browser/cocoa/infobar_text_field.mm ('k') | chrome/browser/cocoa/toolbar_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Name: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #import <Cocoa/Cocoa.h>
6
7 #include "chrome/browser/cocoa/cocoa_test_helper.h"
8 #import "chrome/browser/cocoa/infobar_text_field.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "testing/platform_test.h"
11
12 @interface TextFieldDelegatePong: NSObject {
13 @private
14 BOOL pong_;
15 }
16 @property(readonly) BOOL pong;
17 @end
18
19 @implementation TextFieldDelegatePong
20 @synthesize pong = pong_;
21
22 - (id)init {
23 if ((self == [super init])) {
24 pong_ = NO;
25 }
26 return self;
27 }
28
29 - (void)linkClicked {
30 pong_ = YES;
31 }
32 @end
33
34 namespace {
35
36 ///////////////////////////////////////////////////////////////////////////
37 // Test fixtures
38
39 class InfoBarTextFieldTest : public PlatformTest {
40 protected:
41 CocoaTestHelper helper_;
42 };
43
44 ////////////////////////////////////////////////////////////////////////////
45 // Tests
46
47 TEST_F(InfoBarTextFieldTest, Show) {
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
54 TEST_F(InfoBarTextFieldTest, LinkClicked) {
55 scoped_nsobject<InfoBarTextField> field(
56 [[InfoBarTextField alloc] initWithFrame:NSMakeRect(0, 0, 200, 200)]);
57 scoped_nsobject<TextFieldDelegatePong> delegate(
58 [[TextFieldDelegatePong alloc] init]);
59 [field setDelegate:delegate];
60
61 // Our implementation doesn't look at any of these fields, so they
62 // can all be nil.
63 [field textView:nil clickedOnLink:nil atIndex:0];
64 EXPECT_TRUE([delegate pong]);
65 }
66
67 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/infobar_text_field.mm ('k') | chrome/browser/cocoa/toolbar_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698