| 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_matrix.h" | 5 #import "chrome/browser/ui/cocoa/omnibox/omnibox_popup_matrix.h" |
| 6 | 6 |
| 7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 7 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 8 #import "ui/events/test/cocoa_test_event_utils.h" | 8 #import "ui/events/test/cocoa_test_event_utils.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 clicked_row_(0), | 25 clicked_row_(0), |
| 26 middle_clicked_row_(0) { | 26 middle_clicked_row_(0) { |
| 27 } | 27 } |
| 28 | 28 |
| 29 virtual void SetUp() override { | 29 virtual void SetUp() override { |
| 30 CocoaTest::SetUp(); | 30 CocoaTest::SetUp(); |
| 31 matrix_.reset([[OmniboxPopupMatrix alloc] initWithDelegate:this]); | 31 matrix_.reset([[OmniboxPopupMatrix alloc] initWithDelegate:this]); |
| 32 [[test_window() contentView] addSubview:matrix_]; | 32 [[test_window() contentView] addSubview:matrix_]; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 virtual void OnMatrixRowSelected(OmniboxPopupMatrix* matrix, | 35 void OnMatrixRowSelected(OmniboxPopupMatrix* matrix, size_t row) override { |
| 36 size_t row) override { | |
| 37 selected_row_ = row; | 36 selected_row_ = row; |
| 38 [matrix_ selectCellAtRow:row column:0]; | 37 [matrix_ selectCellAtRow:row column:0]; |
| 39 } | 38 } |
| 40 | 39 |
| 41 virtual void OnMatrixRowClicked(OmniboxPopupMatrix* matrix, | 40 void OnMatrixRowClicked(OmniboxPopupMatrix* matrix, size_t row) override { |
| 42 size_t row) override { | |
| 43 clicked_row_ = row; | 41 clicked_row_ = row; |
| 44 } | 42 } |
| 45 | 43 |
| 46 virtual void OnMatrixRowMiddleClicked(OmniboxPopupMatrix* matrix, | 44 void OnMatrixRowMiddleClicked(OmniboxPopupMatrix* matrix, |
| 47 size_t row) override { | 45 size_t row) override { |
| 48 middle_clicked_row_ = row; | 46 middle_clicked_row_ = row; |
| 49 } | 47 } |
| 50 | 48 |
| 51 protected: | 49 protected: |
| 52 base::scoped_nsobject<OmniboxPopupMatrix> matrix_; | 50 base::scoped_nsobject<OmniboxPopupMatrix> matrix_; |
| 53 size_t selected_row_; | 51 size_t selected_row_; |
| 54 size_t clicked_row_; | 52 size_t clicked_row_; |
| 55 size_t middle_clicked_row_; | 53 size_t middle_clicked_row_; |
| 56 | 54 |
| 57 private: | 55 private: |
| (...skipping 20 matching lines...) Expand all Loading... |
| 78 | 76 |
| 79 [NSApp postEvent:MouseEventInRow(matrix_, NSLeftMouseUp, 2) atStart:YES]; | 77 [NSApp postEvent:MouseEventInRow(matrix_, NSLeftMouseUp, 2) atStart:YES]; |
| 80 [matrix_ mouseDown:MouseEventInRow(matrix_, NSLeftMouseDown, 2)]; | 78 [matrix_ mouseDown:MouseEventInRow(matrix_, NSLeftMouseDown, 2)]; |
| 81 | 79 |
| 82 EXPECT_EQ(2u, selected_row_); | 80 EXPECT_EQ(2u, selected_row_); |
| 83 EXPECT_EQ(2u, clicked_row_); | 81 EXPECT_EQ(2u, clicked_row_); |
| 84 EXPECT_EQ(0u, middle_clicked_row_); | 82 EXPECT_EQ(0u, middle_clicked_row_); |
| 85 } | 83 } |
| 86 | 84 |
| 87 } // namespace | 85 } // namespace |
| OLD | NEW |