chrome/browser/ui/gtk/extensions/media_galleries_dialog_gtk_unittest.cc
// Tests that checkboxes are initialized according to the contents of
// permissions().
Tests that checkboxes are initialized according to the contents of
permissions().
Tests that checkboxes are initialized according to the contents of permissions () .
TEST_F(MediaGalleriesDialogTest, InitializeCheckboxes) {
  NiceMock<MediaGalleriesDialogControllerMock> controller;
  MediaGalleriesDialogController::KnownGalleryPermissions permissions;
  MediaGalleryPrefInfo gallery1 = MakePrefInfoForTesting(1);
  permissions[1] =
      MediaGalleriesDialogController::GalleryPermission(gallery1, true);
  MediaGalleryPrefInfo gallery2 = MakePrefInfoForTesting(2);
  permissions[2] =
      MediaGalleriesDialogController::GalleryPermission(gallery2, false);
  EXPECT_CALL(controller, permissions()).
      WillRepeatedly(ReturnRef(permissions));
  EXPECT_CALL(controller, DidToggleGallery(_, _)).
      Times(0);
  MediaGalleriesDialogGtk dialog(&controller);
  EXPECT_EQ(2U, dialog.checkbox_map_.size());
  GtkWidget* checkbox1 = dialog.checkbox_map_[&permissions[1].pref_info];
  ASSERT_TRUE(GTK_IS_TOGGLE_BUTTON(checkbox1));
  EXPECT_TRUE(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox1)));
  GtkWidget* checkbox2 = dialog.checkbox_map_[&permissions[2].pref_info];
  ASSERT_TRUE(GTK_IS_TOGGLE_BUTTON(checkbox2));
  EXPECT_FALSE(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(checkbox2)));
}
TEST_F ( MediaGalleriesDialogTest , InitializeCheckboxes ) { NiceMock < MediaGalleriesDialogControllerMock > controller ; MediaGalleriesDialogController :: KnownGalleryPermissions permissions ; MediaGalleryPrefInfo gallery1 = MakePrefInfoForTesting ( 1 ) ; permissions [ 1 ] = MediaGalleriesDialogController :: GalleryPermission ( gallery1 , true ) ; MediaGalleryPrefInfo gallery2 = MakePrefInfoForTesting ( 2 ) ; permissions [ 2 ] = MediaGalleriesDialogController :: GalleryPermission ( gallery2 , false ) ; EXPECT_CALL ( controller , permissions ( ) ) . WillRepeatedly ( ReturnRef ( permissions ) ) ; EXPECT_CALL ( controller , DidToggleGallery ( _ , _ ) ) . Times ( 0 ) ; MediaGalleriesDialogGtk dialog ( & controller ) ; EXPECT_EQ ( 2U , dialog . checkbox_map_ . size ( ) ) ; GtkWidget * checkbox1 = dialog . checkbox_map_ [ & permissions [ 1 ] . pref_info ] ; ASSERT_TRUE ( GTK_IS_TOGGLE_BUTTON ( checkbox1 ) ) ; EXPECT_TRUE ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( checkbox1 ) ) ) ; GtkWidget * checkbox2 = dialog . checkbox_map_ [ & permissions [ 2 ] . pref_info ] ; ASSERT_TRUE ( GTK_IS_TOGGLE_BUTTON ( checkbox2 ) ) ; EXPECT_FALSE ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( checkbox2 ) ) ) ; }
Tests that checkboxes are initialized according to the contents of
permissions().
Tests that checkboxes are initialized according to the contents of permissions () .
// Initializing checkboxes should not cause them to be toggled.