chrome/browser/ui/gtk/extensions/media_galleries_dialog_gtk_unittest.cc
// Tests that toggling checkboxes updates the controller.
Tests that toggling checkboxes updates the controller.
Tests that toggling checkboxes updates the controller .
TEST_F(MediaGalleriesDialogTest, ToggleCheckboxes) {
  NiceMock<MediaGalleriesDialogControllerMock> controller;
  MediaGalleriesDialogController::KnownGalleryPermissions permissions;
  MediaGalleryPrefInfo gallery1 = MakePrefInfoForTesting(1);
  permissions[1] =
      MediaGalleriesDialogController::GalleryPermission(gallery1, true);
  EXPECT_CALL(controller, permissions()).
      WillRepeatedly(ReturnRef(permissions));
  MediaGalleriesDialogGtk dialog(&controller);
  EXPECT_EQ(1U, dialog.checkbox_map_.size());
  GtkWidget* checkbox =
      dialog.checkbox_map_[&permissions[1].pref_info];
  ASSERT_TRUE(GTK_IS_TOGGLE_BUTTON(checkbox));
  EXPECT_TRUE(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox)));
  EXPECT_CALL(controller, DidToggleGallery(_, false));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox), FALSE);
  EXPECT_CALL(controller, DidToggleGallery(_, true));
  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox), TRUE);
}
TEST_F ( MediaGalleriesDialogTest , ToggleCheckboxes ) { NiceMock < MediaGalleriesDialogControllerMock > controller ; MediaGalleriesDialogController :: KnownGalleryPermissions permissions ; MediaGalleryPrefInfo gallery1 = MakePrefInfoForTesting ( 1 ) ; permissions [ 1 ] = MediaGalleriesDialogController :: GalleryPermission ( gallery1 , true ) ; EXPECT_CALL ( controller , permissions ( ) ) . WillRepeatedly ( ReturnRef ( permissions ) ) ; MediaGalleriesDialogGtk dialog ( & controller ) ; EXPECT_EQ ( 1U , dialog . checkbox_map_ . size ( ) ) ; GtkWidget * checkbox = dialog . checkbox_map_ [ & permissions [ 1 ] . pref_info ] ; ASSERT_TRUE ( GTK_IS_TOGGLE_BUTTON ( checkbox ) ) ; EXPECT_TRUE ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( checkbox ) ) ) ; EXPECT_CALL ( controller , DidToggleGallery ( _ , false ) ) ; gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( checkbox ) , FALSE ) ; EXPECT_CALL ( controller , DidToggleGallery ( _ , true ) ) ; gtk_toggle_button_set_active ( GTK_TOGGLE_BUTTON ( checkbox ) , TRUE ) ; }
Tests that toggling checkboxes updates the controller.
Tests that toggling checkboxes updates the controller .