| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <ApplicationServices/ApplicationServices.h> | 5 #import <ApplicationServices/ApplicationServices.h> |
| 6 #import <Cocoa/Cocoa.h> | 6 #import <Cocoa/Cocoa.h> |
| 7 | 7 |
| 8 #include "base/mac/foundation_util.h" | 8 #include "base/mac/foundation_util.h" |
| 9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | |
| 11 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" | 10 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" |
| 12 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" | 11 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" |
| 13 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" | 12 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_editor.h" |
| 14 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest_h
elper.h" | 13 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_unittest_h
elper.h" |
| 15 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" | 14 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" |
| 15 #import "chrome/browser/ui/cocoa/test/cocoa_test_helper.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 #import "testing/gtest_mac.h" | 18 #import "testing/gtest_mac.h" |
| 19 #include "testing/platform_test.h" | 19 #include "testing/platform_test.h" |
| 20 #include "ui/base/cocoa/cocoa_base_utils.h" | 20 #include "ui/base/cocoa/cocoa_base_utils.h" |
| 21 | 21 |
| 22 using ::testing::A; | 22 using ::testing::A; |
| 23 using ::testing::InSequence; | 23 using ::testing::InSequence; |
| 24 using ::testing::Return; | 24 using ::testing::Return; |
| 25 using ::testing::ReturnArg; | 25 using ::testing::ReturnArg; |
| (...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 EXPECT_CALL(mock_right_decoration_, OnMousePressed(_, _)) | 630 EXPECT_CALL(mock_right_decoration_, OnMousePressed(_, _)) |
| 631 .WillOnce(Return(true)); | 631 .WillOnce(Return(true)); |
| 632 [field_ mouseDown:downEvent]; | 632 [field_ mouseDown:downEvent]; |
| 633 } | 633 } |
| 634 | 634 |
| 635 // Test that page action menus are properly returned. | 635 // Test that page action menus are properly returned. |
| 636 // TODO(shess): Really, this should test that things are forwarded to | 636 // TODO(shess): Really, this should test that things are forwarded to |
| 637 // the cell, and the cell tests should test that the right things are | 637 // the cell, and the cell tests should test that the right things are |
| 638 // selected. It's easier to mock the event here, though. This code's | 638 // selected. It's easier to mock the event here, though. This code's |
| 639 // event-mockers might be worth promoting to |cocoa_test_event_utils.h| or | 639 // event-mockers might be worth promoting to |cocoa_test_event_utils.h| or |
| 640 // |cocoa_test_helper.h|. | 640 // |test/test/cocoa_test_helper.h|. |
| 641 TEST_F(AutocompleteTextFieldTest, DecorationMenu) { | 641 TEST_F(AutocompleteTextFieldTest, DecorationMenu) { |
| 642 AutocompleteTextFieldCell* cell = [field_ cell]; | 642 AutocompleteTextFieldCell* cell = [field_ cell]; |
| 643 const NSRect bounds([field_ bounds]); | 643 const NSRect bounds([field_ bounds]); |
| 644 | 644 |
| 645 const CGFloat edge = NSHeight(bounds) - 4.0; | 645 const CGFloat edge = NSHeight(bounds) - 4.0; |
| 646 const NSSize size = NSMakeSize(edge, edge); | 646 const NSSize size = NSMakeSize(edge, edge); |
| 647 base::scoped_nsobject<NSImage> image([[NSImage alloc] initWithSize:size]); | 647 base::scoped_nsobject<NSImage> image([[NSImage alloc] initWithSize:size]); |
| 648 | 648 |
| 649 base::scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@"Menu"]); | 649 base::scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@"Menu"]); |
| 650 | 650 |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 924 base::scoped_nsobject<AutocompleteTextField> pin([field_ retain]); | 924 base::scoped_nsobject<AutocompleteTextField> pin([field_ retain]); |
| 925 [field_ removeFromSuperview]; | 925 [field_ removeFromSuperview]; |
| 926 [test_window() resignKeyWindow]; | 926 [test_window() resignKeyWindow]; |
| 927 | 927 |
| 928 [[test_window() contentView] addSubview:field_]; | 928 [[test_window() contentView] addSubview:field_]; |
| 929 EXPECT_CALL(field_observer_, ClosePopup()); | 929 EXPECT_CALL(field_observer_, ClosePopup()); |
| 930 [test_window() resignKeyWindow]; | 930 [test_window() resignKeyWindow]; |
| 931 } | 931 } |
| 932 | 932 |
| 933 } // namespace | 933 } // namespace |
| OLD | NEW |