| 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 "chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.h" | 5 #include "chrome/browser/ui/views/desktop_capture/desktop_media_picker_views.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 std::unique_ptr<DesktopMediaPickerViews> picker_views_; | 92 std::unique_ptr<DesktopMediaPickerViews> picker_views_; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 TEST_F(DesktopMediaPickerViewsTest, DoneCallbackCalledWhenWindowClosed) { | 95 TEST_F(DesktopMediaPickerViewsTest, DoneCallbackCalledWhenWindowClosed) { |
| 96 EXPECT_CALL(*this, OnPickerDone(content::DesktopMediaID())); | 96 EXPECT_CALL(*this, OnPickerDone(content::DesktopMediaID())); |
| 97 | 97 |
| 98 GetPickerDialogView()->GetWidget()->Close(); | 98 GetPickerDialogView()->GetWidget()->Close(); |
| 99 base::RunLoop().RunUntilIdle(); | 99 base::RunLoop().RunUntilIdle(); |
| 100 } | 100 } |
| 101 | 101 |
| 102 TEST_F(DesktopMediaPickerViewsTest, DoneCallbackCalledOnOkButtonPressed) { | 102 // Flaky on Windows. https://crbug.com/644614 |
| 103 #if defined(OS_WIN) |
| 104 #define MAYBE_DoneCallbackCalledOnOkButtonPressed DISABLED_DoneCallbackCalledOnO
kButtonPressed |
| 105 #else |
| 106 #define MAYBE_DoneCallbackCalledOnOkButtonPressed DoneCallbackCalledOnOkButtonPr
essed |
| 107 #endif |
| 108 |
| 109 TEST_F(DesktopMediaPickerViewsTest, MAYBE_DoneCallbackCalledOnOkButtonPressed) { |
| 103 const DesktopMediaID kFakeId(DesktopMediaID::TYPE_WINDOW, 222); | 110 const DesktopMediaID kFakeId(DesktopMediaID::TYPE_WINDOW, 222); |
| 104 EXPECT_CALL(*this, OnPickerDone(kFakeId)); | 111 EXPECT_CALL(*this, OnPickerDone(kFakeId)); |
| 105 | 112 |
| 106 media_lists_[DesktopMediaID::TYPE_WINDOW]->AddSourceByFullMediaID(kFakeId); | 113 media_lists_[DesktopMediaID::TYPE_WINDOW]->AddSourceByFullMediaID(kFakeId); |
| 107 GetPickerDialogView()->GetCheckboxForTesting()->SetChecked(true); | 114 GetPickerDialogView()->GetCheckboxForTesting()->SetChecked(true); |
| 108 | 115 |
| 109 EXPECT_FALSE( | 116 EXPECT_FALSE( |
| 110 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); | 117 GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK)); |
| 111 | 118 |
| 112 EXPECT_TRUE(ClickSourceTypeButton(DesktopMediaID::TYPE_WINDOW)); | 119 EXPECT_TRUE(ClickSourceTypeButton(DesktopMediaID::TYPE_WINDOW)); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 314 |
| 308 EXPECT_TRUE(ClickSourceTypeButton(DesktopMediaID::TYPE_WEB_CONTENTS)); | 315 EXPECT_TRUE(ClickSourceTypeButton(DesktopMediaID::TYPE_WEB_CONTENTS)); |
| 309 GetPickerDialogView()->GetCheckboxForTesting()->SetChecked(true); | 316 GetPickerDialogView()->GetCheckboxForTesting()->SetChecked(true); |
| 310 GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnFocus(); | 317 GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnFocus(); |
| 311 | 318 |
| 312 GetPickerDialogView()->GetDialogClientView()->AcceptWindow(); | 319 GetPickerDialogView()->GetDialogClientView()->AcceptWindow(); |
| 313 base::RunLoop().RunUntilIdle(); | 320 base::RunLoop().RunUntilIdle(); |
| 314 } | 321 } |
| 315 | 322 |
| 316 } // namespace views | 323 } // namespace views |
| OLD | NEW |