OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/media/fake_desktop_media_list.h" | 8 #include "chrome/browser/media/fake_desktop_media_list.h" |
9 #include "chrome/browser/ui/views/desktop_media_picker_views.h" | 9 #include "chrome/browser/ui/views/desktop_media_picker_views.h" |
10 #include "components/web_modal/test_web_contents_modal_dialog_host.h" | 10 #include "components/web_modal/test_web_contents_modal_dialog_host.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 base::RunLoop().RunUntilIdle(); | 119 base::RunLoop().RunUntilIdle(); |
120 } | 120 } |
121 | 121 |
122 TEST_F(DesktopMediaPickerViewsTest, DoneCallbackCalledOnDoubleTap) { | 122 TEST_F(DesktopMediaPickerViewsTest, DoneCallbackCalledOnDoubleTap) { |
123 const int kFakeId = 222; | 123 const int kFakeId = 222; |
124 EXPECT_CALL(*this, | 124 EXPECT_CALL(*this, |
125 OnPickerDone(content::DesktopMediaID( | 125 OnPickerDone(content::DesktopMediaID( |
126 content::DesktopMediaID::TYPE_WINDOW, kFakeId))); | 126 content::DesktopMediaID::TYPE_WINDOW, kFakeId))); |
127 | 127 |
128 media_list_->AddSource(kFakeId); | 128 media_list_->AddSource(kFakeId); |
129 ui::GestureEventDetails details(ui::ET_GESTURE_TAP); | 129 |
130 details.set_tap_count(2); | 130 ui::GestureEvent double_tap( |
131 ui::GestureEvent double_tap(10, 10, 0, base::TimeDelta(), details); | 131 10, |
| 132 10, |
| 133 0, |
| 134 base::TimeDelta(), |
| 135 ui::GestureEventDetails(ui::ET_GESTURE_TAP, 2, 0)); |
132 | 136 |
133 GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnGestureEvent( | 137 GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnGestureEvent( |
134 &double_tap); | 138 &double_tap); |
135 base::RunLoop().RunUntilIdle(); | 139 base::RunLoop().RunUntilIdle(); |
136 } | 140 } |
137 | 141 |
138 TEST_F(DesktopMediaPickerViewsTest, CancelButtonAlwaysEnabled) { | 142 TEST_F(DesktopMediaPickerViewsTest, CancelButtonAlwaysEnabled) { |
139 EXPECT_TRUE( | 143 EXPECT_TRUE( |
140 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_CANCEL)); | 144 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_CANCEL)); |
141 } | 145 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnFocus(); | 197 GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnFocus(); |
194 EXPECT_TRUE( | 198 EXPECT_TRUE( |
195 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); | 199 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); |
196 | 200 |
197 media_list_->RemoveSource(0); | 201 media_list_->RemoveSource(0); |
198 EXPECT_FALSE( | 202 EXPECT_FALSE( |
199 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); | 203 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); |
200 } | 204 } |
201 | 205 |
202 } // namespace views | 206 } // namespace views |
OLD | NEW |