| 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/omnibox/omnibox_popup_cell.h" | 5 #import "chrome/browser/ui/cocoa/omnibox/omnibox_popup_cell.h" |
| 6 #import "chrome/browser/ui/cocoa/omnibox/omnibox_popup_matrix.h" | 6 #import "chrome/browser/ui/cocoa/omnibox/omnibox_popup_matrix.h" |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 11 #import "chrome/browser/ui/cocoa/test/cocoa_test_helper.h" |
| 12 #import "ui/events/test/cocoa_test_event_utils.h" | 12 #import "ui/events/test/cocoa_test_event_utils.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 NSEvent* MouseEventInRow(OmniboxPopupMatrix* matrix, | 16 NSEvent* MouseEventInRow(OmniboxPopupMatrix* matrix, |
| 17 NSEventType type, | 17 NSEventType type, |
| 18 NSInteger row) { | 18 NSInteger row) { |
| 19 NSRect cell_rect = [matrix rectOfRow:row]; | 19 NSRect cell_rect = [matrix rectOfRow:row]; |
| 20 NSPoint point_in_view = NSMakePoint(NSMidX(cell_rect), NSMidY(cell_rect)); | 20 NSPoint point_in_view = NSMakePoint(NSMidX(cell_rect), NSMidY(cell_rect)); |
| 21 NSPoint point_in_window = [matrix convertPoint:point_in_view toView:nil]; | 21 NSPoint point_in_window = [matrix convertPoint:point_in_view toView:nil]; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 TEST_F(OmniboxPopupMatrixTest, SelectedRow) { | 86 TEST_F(OmniboxPopupMatrixTest, SelectedRow) { |
| 87 [NSApp postEvent:MouseEventInRow(matrix_, NSLeftMouseUp, 2) atStart:YES]; | 87 [NSApp postEvent:MouseEventInRow(matrix_, NSLeftMouseUp, 2) atStart:YES]; |
| 88 [matrix_ mouseDown:MouseEventInRow(matrix_, NSLeftMouseDown, 2)]; | 88 [matrix_ mouseDown:MouseEventInRow(matrix_, NSLeftMouseDown, 2)]; |
| 89 | 89 |
| 90 EXPECT_EQ(2u, selected_row_); | 90 EXPECT_EQ(2u, selected_row_); |
| 91 EXPECT_EQ(2u, clicked_row_); | 91 EXPECT_EQ(2u, clicked_row_); |
| 92 EXPECT_EQ(0u, middle_clicked_row_); | 92 EXPECT_EQ(0u, middle_clicked_row_); |
| 93 } | 93 } |
| 94 | 94 |
| 95 } // namespace | 95 } // namespace |
| OLD | NEW |