Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / browser / ui / cocoa / location_bar / autocomplete_text_field_unittest_helper.mm
blob38d27935340e8d7dbedaf36c2b98026c601a4053
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.
5 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest_helper.h"
7 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
8 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h"
9 #include "testing/gtest/include/gtest/gtest.h"
11 @implementation AutocompleteTextFieldWindowTestDelegate
13 - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)anObject {
14   id editor = nil;
15   if ([anObject isKindOfClass:[AutocompleteTextField class]]) {
16     if (editor_ == nil) {
17       editor_.reset([[AutocompleteTextFieldEditor alloc] init]);
18     }
19     EXPECT_TRUE(editor_ != nil);
21     // This needs to be called every time, otherwise notifications
22     // aren't sent correctly.
23     [editor_ setFieldEditor:YES];
24     editor = editor_.get();
25   }
26   return editor;
29 @end
31 MockAutocompleteTextFieldObserver::MockAutocompleteTextFieldObserver() {}
33 MockAutocompleteTextFieldObserver::~MockAutocompleteTextFieldObserver() {}