OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/ui/cocoa/autofill/autofill_textfield.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_textfield.h" |
6 | 6 |
7 #import "base/mac/scoped_nsobject.h" | 7 #import "base/mac/scoped_nsobject.h" |
8 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 8 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "testing/gtest_mac.h" | 10 #include "testing/gtest_mac.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | |
11 #include "testing/platform_test.h" | 11 #include "testing/platform_test.h" |
12 #include "ui/events/test/cocoa_test_event_utils.h" | 12 #include "ui/events/test/cocoa_test_event_utils.h" |
13 | 13 |
14 class AutofillTextFieldTest : public CocoaTest { | 14 class AutofillTextFieldTest : public CocoaTest { |
15 public: | 15 public: |
16 AutofillTextFieldTest() { | 16 AutofillTextFieldTest() { |
17 NSRect frame = NSMakeRect(0, 0, 50, 30); | 17 NSRect frame = NSMakeRect(0, 0, 50, 30); |
18 textfield_.reset([[AutofillTextField alloc] initWithFrame:frame]); | 18 textfield_.reset([[AutofillTextField alloc] initWithFrame:frame]); |
19 [textfield_ setStringValue:@"Abcdefg"]; | 19 [textfield_ setStringValue:@"Abcdefg"]; |
20 [textfield_ sizeToFit]; | 20 [textfield_ sizeToFit]; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 // Now test with multiline mode enabled. | 69 // Now test with multiline mode enabled. |
70 [textfield_ setIsMultiline:YES]; | 70 [textfield_ setIsMultiline:YES]; |
71 [textfield_ setStringValue:@""]; | 71 [textfield_ setStringValue:@""]; |
72 [[textfield_ currentEditor] insertText:@"foo"]; | 72 [[textfield_ currentEditor] insertText:@"foo"]; |
73 [[textfield_ currentEditor] | 73 [[textfield_ currentEditor] |
74 keyDown:cocoa_test_event_utils::KeyEventWithCharacter('\n')]; | 74 keyDown:cocoa_test_event_utils::KeyEventWithCharacter('\n')]; |
75 [[textfield_ currentEditor] insertText:@"bar"]; | 75 [[textfield_ currentEditor] insertText:@"bar"]; |
76 EXPECT_NSEQ(@"foo\nbar", [textfield_ stringValue]); | 76 EXPECT_NSEQ(@"foo\nbar", [textfield_ stringValue]); |
77 } | 77 } |
OLD | NEW |