| OLD | NEW |
| 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 #import "base/cocoa_protocols_mac.h" |
| 7 #include "base/scoped_nsobject.h" | 8 #include "base/scoped_nsobject.h" |
| 8 #import "chrome/browser/cocoa/autocomplete_text_field.h" | 9 #import "chrome/browser/cocoa/autocomplete_text_field.h" |
| 9 #import "chrome/browser/cocoa/autocomplete_text_field_cell.h" | 10 #import "chrome/browser/cocoa/autocomplete_text_field_cell.h" |
| 10 #import "chrome/browser/cocoa/autocomplete_text_field_editor.h" | 11 #import "chrome/browser/cocoa/autocomplete_text_field_editor.h" |
| 11 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 12 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "testing/platform_test.h" | 14 #include "testing/platform_test.h" |
| 14 | 15 |
| 15 @interface AutocompleteTextFieldTestDelegate : NSObject { | 16 @interface AutocompleteTextFieldTestDelegate : NSObject { |
| 16 BOOL textShouldPaste_; | 17 BOOL textShouldPaste_; |
| 17 BOOL receivedTextShouldPaste_; | 18 BOOL receivedTextShouldPaste_; |
| 18 BOOL receivedFlagsChanged_; | 19 BOOL receivedFlagsChanged_; |
| 19 BOOL receivedControlTextDidBeginEditing_; | 20 BOOL receivedControlTextDidBeginEditing_; |
| 20 BOOL receivedControlTextShouldEndEditing_; | 21 BOOL receivedControlTextShouldEndEditing_; |
| 21 } | 22 } |
| 22 - initWithTextShouldPaste:(BOOL)flag; | 23 - initWithTextShouldPaste:(BOOL)flag; |
| 23 - (BOOL)receivedTextShouldPaste; | 24 - (BOOL)receivedTextShouldPaste; |
| 24 - (BOOL)receivedFlagsChanged; | 25 - (BOOL)receivedFlagsChanged; |
| 25 - (BOOL)receivedControlTextDidBeginEditing; | 26 - (BOOL)receivedControlTextDidBeginEditing; |
| 26 - (BOOL)receivedControlTextShouldEndEditing; | 27 - (BOOL)receivedControlTextShouldEndEditing; |
| 27 @end | 28 @end |
| 28 | 29 |
| 29 @interface AutocompleteTextFieldWindowTestDelegate : NSObject { | 30 @interface AutocompleteTextFieldWindowTestDelegate : |
| 31 NSObject<NSWindowDelegate> { |
| 30 scoped_nsobject<AutocompleteTextFieldEditor> editor_; | 32 scoped_nsobject<AutocompleteTextFieldEditor> editor_; |
| 31 } | 33 } |
| 32 - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)anObject; | 34 - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)anObject; |
| 33 @end | 35 @end |
| 34 | 36 |
| 35 namespace { | 37 namespace { |
| 36 | 38 |
| 37 class AutocompleteTextFieldTest : public PlatformTest { | 39 class AutocompleteTextFieldTest : public PlatformTest { |
| 38 public: | 40 public: |
| 39 AutocompleteTextFieldTest() { | 41 AutocompleteTextFieldTest() { |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 359 } |
| 358 EXPECT_TRUE(editor_ != nil); | 360 EXPECT_TRUE(editor_ != nil); |
| 359 | 361 |
| 360 // This needs to be called every time, otherwise notifications | 362 // This needs to be called every time, otherwise notifications |
| 361 // aren't sent correctly. | 363 // aren't sent correctly. |
| 362 [editor_ setFieldEditor:YES]; | 364 [editor_ setFieldEditor:YES]; |
| 363 return editor_; | 365 return editor_; |
| 364 } | 366 } |
| 365 | 367 |
| 366 @end | 368 @end |
| OLD | NEW |