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 | 129 ui::GestureEventDetails details(ui::ET_GESTURE_TAP); |
130 ui::GestureEvent double_tap( | 130 details.set_tap_count(2); |
131 10, | 131 ui::GestureEvent double_tap(10, 10, 0, base::TimeDelta(), details); |
132 10, | |
133 0, | |
134 base::TimeDelta(), | |
135 ui::GestureEventDetails(ui::ET_GESTURE_TAP, 2, 0)); | |
136 | 132 |
137 GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnGestureEvent( | 133 GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnGestureEvent( |
138 &double_tap); | 134 &double_tap); |
139 base::RunLoop().RunUntilIdle(); | 135 base::RunLoop().RunUntilIdle(); |
140 } | 136 } |
141 | 137 |
142 TEST_F(DesktopMediaPickerViewsTest, CancelButtonAlwaysEnabled) { | 138 TEST_F(DesktopMediaPickerViewsTest, CancelButtonAlwaysEnabled) { |
143 EXPECT_TRUE( | 139 EXPECT_TRUE( |
144 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_CANCEL)); | 140 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_CANCEL)); |
145 } | 141 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnFocus(); | 193 GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnFocus(); |
198 EXPECT_TRUE( | 194 EXPECT_TRUE( |
199 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); | 195 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); |
200 | 196 |
201 media_list_->RemoveSource(0); | 197 media_list_->RemoveSource(0); |
202 EXPECT_FALSE( | 198 EXPECT_FALSE( |
203 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); | 199 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); |
204 } | 200 } |
205 | 201 |
206 } // namespace views | 202 } // namespace views |
OLD | NEW |