Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Unified Diff: chrome/browser/ui/views/desktop_media_picker_views_unittest.cc

Issue 1313843003: Enable keyboard navigation for Desktopcapture window selection dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Two more unit tests Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/desktop_media_picker_views.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/desktop_media_picker_views_unittest.cc
diff --git a/chrome/browser/ui/views/desktop_media_picker_views_unittest.cc b/chrome/browser/ui/views/desktop_media_picker_views_unittest.cc
index d43e36c9b598a9e4c2ff9002c9014a709d4b480c..3061f4bbb72cfb22e6fb7ef601dba13370af8571 100644
--- a/chrome/browser/ui/views/desktop_media_picker_views_unittest.cc
+++ b/chrome/browser/ui/views/desktop_media_picker_views_unittest.cc
@@ -87,6 +87,51 @@ TEST_F(DesktopMediaPickerViewsTest, DoneCallbackCalledOnOkButtonPressed) {
base::RunLoop().RunUntilIdle();
}
+// Verifies that cancel button click leads to dialog close without notify a
+// selection of MediaSourceView.
Peter Kasting 2015/10/05 20:59:46 The comments in and around these new tests have gr
gyzhou 2015/10/05 21:12:27 This it the reason I asked Sergey to specially pay
+TEST_F(DesktopMediaPickerViewsTest, DoneCallbackCalledOnCancelButtonPressed) {
+ EXPECT_CALL(*this, OnPickerDone(content::DesktopMediaID()));
+
+ const int kFakeId = 222;
+ media_list_->AddSource(kFakeId);
+ GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnFocus();
+
+ GetPickerDialogView()->GetDialogClientView()->CancelWindow();
+ base::RunLoop().RunUntilIdle();
+}
+
+// Verifies that a MediaSourceView is selected with mouse left click and
+// original selected MediaSourceView gets unselected.
+TEST_F(DesktopMediaPickerViewsTest, SelectMediaSourceViewOnSingleClick) {
+ media_list_->AddSource(0);
+ media_list_->AddSource(1);
+
+ DesktopMediaSourceView* source_view_0 =
+ GetPickerDialogView()->GetMediaSourceViewForTesting(0);
+
+ DesktopMediaSourceView* source_view_1 =
+ GetPickerDialogView()->GetMediaSourceViewForTesting(1);
+
+ // Both media source views are not selected initially.
+ EXPECT_FALSE(source_view_0->is_selected());
+ EXPECT_FALSE(source_view_1->is_selected());
+
+ // Source view 0 is selected with mouse click.
+ ui::MouseEvent press(ui::ET_MOUSE_PRESSED, gfx::Point(), gfx::Point(),
+ ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0);
+
+ GetPickerDialogView()->GetMediaSourceViewForTesting(0)->OnMousePressed(press);
+
+ EXPECT_TRUE(source_view_0->is_selected());
+ EXPECT_FALSE(source_view_1->is_selected());
+
+ // Source view 1 is selected and source view 0 is unselected with mouse click.
+ GetPickerDialogView()->GetMediaSourceViewForTesting(1)->OnMousePressed(press);
+
+ EXPECT_FALSE(source_view_0->is_selected());
+ EXPECT_TRUE(source_view_1->is_selected());
+}
+
TEST_F(DesktopMediaPickerViewsTest, DoneCallbackCalledOnDoubleClick) {
const int kFakeId = 222;
EXPECT_CALL(*this,
@@ -185,4 +230,9 @@ TEST_F(DesktopMediaPickerViewsTest, OkButtonDisabledWhenNoSelection) {
GetPickerDialogView()->IsDialogButtonEnabled(ui::DIALOG_BUTTON_OK));
}
+// Verifies that the MediaListView get the initial focus.
+TEST_F(DesktopMediaPickerViewsTest, ListViewHasInitialFocus) {
+ EXPECT_TRUE(GetPickerDialogView()->GetMediaListViewForTesting()->HasFocus());
+}
+
} // namespace views
« no previous file with comments | « chrome/browser/ui/views/desktop_media_picker_views.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698