| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 } | 88 } |
| 89 | 89 |
| 90 TEST_F(DesktopMediaPickerViewsTest, DoneCallbackCalledOnDoubleClick) { | 90 TEST_F(DesktopMediaPickerViewsTest, DoneCallbackCalledOnDoubleClick) { |
| 91 const int kFakeId = 222; | 91 const int kFakeId = 222; |
| 92 EXPECT_CALL(*this, | 92 EXPECT_CALL(*this, |
| 93 OnPickerDone(content::DesktopMediaID( | 93 OnPickerDone(content::DesktopMediaID( |
| 94 content::DesktopMediaID::TYPE_WINDOW, kFakeId))); | 94 content::DesktopMediaID::TYPE_WINDOW, kFakeId))); |
| 95 | 95 |
| 96 media_list_->AddSource(kFakeId); | 96 media_list_->AddSource(kFakeId); |
| 97 | 97 |
| 98 ui::MouseEvent double_click(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), | 98 ui::MouseEvent double_click( |
| 99 ui::EventTimeForNow(), | 99 ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(), ui::EventTimeForNow(), |
| 100 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK, | 100 ui::EF_LEFT_MOUSE_BUTTON | ui::EF_IS_DOUBLE_CLICK, |
| 101 ui::EF_LEFT_MOUSE_BUTTON); | 101 ui::EF_LEFT_MOUSE_BUTTON, |
| 102 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)); |
| 102 | 103 |
| 103 GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnMousePressed( | 104 GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnMousePressed( |
| 104 double_click); | 105 double_click); |
| 105 base::RunLoop().RunUntilIdle(); | 106 base::RunLoop().RunUntilIdle(); |
| 106 } | 107 } |
| 107 | 108 |
| 108 TEST_F(DesktopMediaPickerViewsTest, DoneCallbackCalledOnDoubleTap) { | 109 TEST_F(DesktopMediaPickerViewsTest, DoneCallbackCalledOnDoubleTap) { |
| 109 const int kFakeId = 222; | 110 const int kFakeId = 222; |
| 110 EXPECT_CALL(*this, | 111 EXPECT_CALL(*this, |
| 111 OnPickerDone(content::DesktopMediaID( | 112 OnPickerDone(content::DesktopMediaID( |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnFocus(); | 180 GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnFocus(); |
| 180 EXPECT_TRUE( | 181 EXPECT_TRUE( |
| 181 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); | 182 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); |
| 182 | 183 |
| 183 media_list_->RemoveSource(0); | 184 media_list_->RemoveSource(0); |
| 184 EXPECT_FALSE( | 185 EXPECT_FALSE( |
| 185 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); | 186 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); |
| 186 } | 187 } |
| 187 | 188 |
| 188 } // namespace views | 189 } // namespace views |
| OLD | NEW |