chrome/browser/media_gallery/media_galleries_preferences_unittest.cc
// Whenever a gallery is added, check to see if there is any gallery info exists
// for the added gallery. If so, verify the existing gallery information with
// the new details. If there is a mismatch, update the gallery information
// accordingly.
Whenever a gallery is added, check to see if there is any gallery info exists
for the added gallery. If so, verify the existing gallery information with
the new details. If there is a mismatch, update the gallery information
accordingly.
Whenever a gallery is added check to see if there is any gallery info exists for the added gallery . If so verify the existing gallery information with the new details . If there is a mismatch update the gallery information accordingly .
TEST_F(MediaGalleriesPreferencesTest, UpdateGalleryDetails) {
  MediaGalleryPrefId auto_id, id;
  FilePath path;
  std::string device_id;
  string16 device_name;
  FilePath relative_path;
  Verify();
  path = MakePath("new_auto");
  MediaStorageUtil::GetDeviceInfoFromPath(path, &device_id, NULL,
                                          &relative_path);
  device_name = ASCIIToUTF16("NewAutoGallery");
  id = gallery_prefs()->AddGallery(device_id, device_name, relative_path,
                                   false );
  EXPECT_EQ(default_galleries_count() + 1UL, id);
  auto_id = id;
  AddGalleryExpectation(id, device_name, device_id, relative_path,
                        MediaGalleryPrefInfo::kAutoDetected);
  Verify();
  device_name = ASCIIToUTF16("AutoGallery2");
  id = gallery_prefs()->AddGallery(device_id, device_name, relative_path,
                                   false );
  EXPECT_EQ(auto_id, id);
  AddGalleryExpectation(id, device_name, device_id, relative_path,
                        MediaGalleryPrefInfo::kAutoDetected);
  Verify();
}
TEST_F ( MediaGalleriesPreferencesTest , UpdateGalleryDetails ) { MediaGalleryPrefId auto_id , id ; FilePath path ; std :: string device_id ; string16 device_name ; FilePath relative_path ; Verify ( ) ; path = MakePath ( " " ) ; MediaStorageUtil :: GetDeviceInfoFromPath ( path , & device_id , NULL , & relative_path ) ; device_name = ASCIIToUTF16 ( " " ) ; id = gallery_prefs ( ) -> AddGallery ( device_id , device_name , relative_path , false ) ; EXPECT_EQ ( default_galleries_count ( ) + 1UL , id ) ; auto_id = id ; AddGalleryExpectation ( id , device_name , device_id , relative_path , MediaGalleryPrefInfo :: kAutoDetected ) ; Verify ( ) ; device_name = ASCIIToUTF16 ( " " ) ; id = gallery_prefs ( ) -> AddGallery ( device_id , device_name , relative_path , false ) ; EXPECT_EQ ( auto_id , id ) ; AddGalleryExpectation ( id , device_name , device_id , relative_path , MediaGalleryPrefInfo :: kAutoDetected ) ; Verify ( ) ; }
Whenever a gallery is added, check to see if there is any gallery info exists
for the added gallery.
Whenever a gallery is added check to see if there is any gallery info exists for the added gallery .
// Add a new auto detect gallery to test with. /*auto*/ // Update the device name and add the gallery again. /*auto*/