| 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 #import "base/cocoa_protocols_mac.h" |
| 8 #include "base/scoped_nsobject.h" | 8 #include "base/scoped_nsobject.h" |
| 9 #import "chrome/browser/cocoa/autocomplete_text_field.h" | 9 #import "chrome/browser/cocoa/autocomplete_text_field.h" |
| 10 #import "chrome/browser/cocoa/autocomplete_text_field_cell.h" | 10 #import "chrome/browser/cocoa/autocomplete_text_field_cell.h" |
| 11 #import "chrome/browser/cocoa/autocomplete_text_field_editor.h" | 11 #import "chrome/browser/cocoa/autocomplete_text_field_editor.h" |
| 12 #import "chrome/browser/cocoa/autocomplete_text_field_unittest_helper.h" | 12 #import "chrome/browser/cocoa/autocomplete_text_field_unittest_helper.h" |
| 13 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 13 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
| 14 #include "testing/gmock/include/gmock/gmock.h" | 14 #include "testing/gmock/include/gmock/gmock.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "testing/platform_test.h" | 16 #include "testing/platform_test.h" |
| 17 | 17 |
| 18 using ::testing::InSequence; | 18 using ::testing::InSequence; |
| 19 using ::testing::Return; | 19 using ::testing::Return; |
| 20 using ::testing::StrictMock; | 20 using ::testing::StrictMock; |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 // Mock a SecurityImageView. | |
| 24 class MockSecurityImageView : public LocationBarViewMac::SecurityImageView { | 23 class MockSecurityImageView : public LocationBarViewMac::SecurityImageView { |
| 25 public: | 24 public: |
| 26 MockSecurityImageView(Profile* profile, ToolbarModel* model) | 25 MockSecurityImageView(Profile* profile, ToolbarModel* model) |
| 27 : LocationBarViewMac::SecurityImageView(profile, model) {} | 26 : LocationBarViewMac::SecurityImageView(profile, model) {} |
| 28 | 27 |
| 29 MOCK_METHOD0(OnMousePressed, bool()); | 28 MOCK_METHOD0(OnMousePressed, bool()); |
| 30 }; | 29 }; |
| 31 | 30 |
| 32 // Mock up an incrementing event number. | 31 // Mock up an incrementing event number. |
| 33 NSUInteger eventNumber = 0; | 32 NSUInteger eventNumber = 0; |
| 34 | 33 |
| 35 // Create an event of the indicated |type| at |point| within |view|. | 34 // Create an event of the indicated |type| at |point| within |view|. |
| 36 // TODO(shess): Would be nice to have a MockApplication which provided | 35 // TODO(shess): Would be nice to have a MockApplication which provided |
| 37 // nifty accessors to create these things and inject them. It could | 36 // nifty accessors to create these things and inject them. It could |
| (...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 scoped_nsobject<AutocompleteTextField> pin([field_ retain]); | 684 scoped_nsobject<AutocompleteTextField> pin([field_ retain]); |
| 686 [field_ removeFromSuperview]; | 685 [field_ removeFromSuperview]; |
| 687 [test_window() resignKeyWindow]; | 686 [test_window() resignKeyWindow]; |
| 688 | 687 |
| 689 [[test_window() contentView] addSubview:field_]; | 688 [[test_window() contentView] addSubview:field_]; |
| 690 EXPECT_CALL(field_observer_, OnDidResignKey()); | 689 EXPECT_CALL(field_observer_, OnDidResignKey()); |
| 691 [test_window() resignKeyWindow]; | 690 [test_window() resignKeyWindow]; |
| 692 } | 691 } |
| 693 | 692 |
| 694 } // namespace | 693 } // namespace |
| OLD | NEW |