| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
| 25 | 25 |
| 26 #if defined(OS_CHROMEOS) | 26 #if defined(OS_CHROMEOS) |
| 27 #include "chrome/browser/chromeos/login/user_manager.h" | 27 #include "chrome/browser/chromeos/login/user_manager.h" |
| 28 #include "chrome/browser/chromeos/settings/cros_settings.h" | 28 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 29 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 29 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 30 #endif | 30 #endif |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 MediaGalleryPrefId AddScanResult(MediaGalleriesPreferences* gallery_prefs, | |
| 35 const std::string& path, int audio_count, | |
| 36 int image_count, int video_count) { | |
| 37 MediaGalleryPrefInfo gallery_info; | |
| 38 gallery_prefs->LookUpGalleryByPath( | |
| 39 MakeMediaGalleriesTestingPath(path), &gallery_info); | |
| 40 return gallery_prefs->AddGallery( | |
| 41 gallery_info.device_id, | |
| 42 gallery_info.path, | |
| 43 MediaGalleryPrefInfo::kScanResult, | |
| 44 gallery_info.volume_label, | |
| 45 gallery_info.vendor_name, | |
| 46 gallery_info.model_name, | |
| 47 gallery_info.total_size_in_bytes, | |
| 48 gallery_info.last_attach_time, | |
| 49 audio_count, image_count, video_count); | |
| 50 } | |
| 51 | |
| 52 class MockMediaGalleriesScanResultDialog | 34 class MockMediaGalleriesScanResultDialog |
| 53 : public MediaGalleriesScanResultDialog { | 35 : public MediaGalleriesScanResultDialog { |
| 54 public: | 36 public: |
| 55 typedef base::Callback<void(int update_count)> DialogDestroyedCallback; | 37 typedef base::Callback<void(int update_count)> DialogDestroyedCallback; |
| 56 | 38 |
| 57 explicit MockMediaGalleriesScanResultDialog( | 39 explicit MockMediaGalleriesScanResultDialog( |
| 58 const DialogDestroyedCallback& callback) | 40 const DialogDestroyedCallback& callback) |
| 59 : update_count_(0), | 41 : update_count_(0), |
| 60 dialog_destroyed_callback_(callback) { | 42 dialog_destroyed_callback_(callback) { |
| 61 } | 43 } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 } | 132 } |
| 151 | 133 |
| 152 extensions::Extension* extension() { | 134 extensions::Extension* extension() { |
| 153 return extension_.get(); | 135 return extension_.get(); |
| 154 } | 136 } |
| 155 | 137 |
| 156 MediaGalleriesPreferences* gallery_prefs() { | 138 MediaGalleriesPreferences* gallery_prefs() { |
| 157 return gallery_prefs_.get(); | 139 return gallery_prefs_.get(); |
| 158 } | 140 } |
| 159 | 141 |
| 142 MediaGalleryPrefId AddGallery(const std::string& path, |
| 143 MediaGalleryPrefInfo::Type type, |
| 144 int audio_count, int image_count, |
| 145 int video_count) { |
| 146 MediaGalleryPrefInfo gallery_info; |
| 147 gallery_prefs_->LookUpGalleryByPath(MakeMediaGalleriesTestingPath(path), |
| 148 &gallery_info); |
| 149 return gallery_prefs_->AddGallery( |
| 150 gallery_info.device_id, |
| 151 gallery_info.path, |
| 152 type, |
| 153 gallery_info.volume_label, |
| 154 gallery_info.vendor_name, |
| 155 gallery_info.model_name, |
| 156 gallery_info.total_size_in_bytes, |
| 157 gallery_info.last_attach_time, |
| 158 audio_count, image_count, video_count); |
| 159 } |
| 160 |
| 161 MediaGalleryPrefId AddScanResult(const std::string& path, int audio_count, |
| 162 int image_count, int video_count) { |
| 163 return AddGallery(path, MediaGalleryPrefInfo::kScanResult, audio_count, |
| 164 image_count, video_count); |
| 165 } |
| 166 |
| 160 private: | 167 private: |
| 161 MediaGalleriesScanResultDialog* CreateMockDialog( | 168 MediaGalleriesScanResultDialog* CreateMockDialog( |
| 162 MediaGalleriesScanResultDialogController* controller) { | 169 MediaGalleriesScanResultDialogController* controller) { |
| 163 EXPECT_FALSE(dialog_); | 170 EXPECT_FALSE(dialog_); |
| 164 dialog_update_count_at_destruction_ = 0; | 171 dialog_update_count_at_destruction_ = 0; |
| 165 dialog_ = new MockMediaGalleriesScanResultDialog(base::Bind( | 172 dialog_ = new MockMediaGalleriesScanResultDialog(base::Bind( |
| 166 &MediaGalleriesScanResultDialogControllerTest::OnDialogDestroyed, | 173 &MediaGalleriesScanResultDialogControllerTest::OnDialogDestroyed, |
| 167 weak_factory_.GetWeakPtr())); | 174 weak_factory_.GetWeakPtr())); |
| 168 return dialog_; | 175 return dialog_; |
| 169 } | 176 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 EXPECT_EQ(0U, controller()->GetGalleryList().size()); | 223 EXPECT_EQ(0U, controller()->GetGalleryList().size()); |
| 217 | 224 |
| 218 controller()->DialogFinished(true); | 225 controller()->DialogFinished(true); |
| 219 EXPECT_FALSE(controller()); | 226 EXPECT_FALSE(controller()); |
| 220 EXPECT_FALSE(dialog()); | 227 EXPECT_FALSE(dialog()); |
| 221 EXPECT_EQ(0, dialog_update_count_at_destruction()); | 228 EXPECT_EQ(0, dialog_update_count_at_destruction()); |
| 222 } | 229 } |
| 223 | 230 |
| 224 TEST_F(MediaGalleriesScanResultDialogControllerTest, AddScanResults) { | 231 TEST_F(MediaGalleriesScanResultDialogControllerTest, AddScanResults) { |
| 225 // Start with two scan results. | 232 // Start with two scan results. |
| 226 MediaGalleryPrefId scan1 = | 233 MediaGalleryPrefId scan_id = AddScanResult("scan_id", 1, 0, 0); |
| 227 gallery_prefs()->AddGalleryByPath(MakeMediaGalleriesTestingPath("scan1"), | 234 MediaGalleryPrefId auto_id = |
| 228 MediaGalleryPrefInfo::kScanResult); | 235 AddGallery("auto_id", MediaGalleryPrefInfo::kAutoDetected, 2, 0, 0); |
| 229 MediaGalleryPrefId scan2 = | |
| 230 gallery_prefs()->AddGalleryByPath(MakeMediaGalleriesTestingPath("scan2"), | |
| 231 MediaGalleryPrefInfo::kScanResult); | |
| 232 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); | 236 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); |
| 233 | 237 |
| 234 // Show the dialog, but cancel it. | 238 // Show the dialog, but cancel it. |
| 235 StartDialog(); | 239 StartDialog(); |
| 236 EXPECT_EQ(2U, controller()->GetGalleryList().size()); | 240 EXPECT_EQ(2U, controller()->GetGalleryList().size()); |
| 237 controller()->DialogFinished(false); | 241 controller()->DialogFinished(false); |
| 238 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); | 242 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); |
| 239 | 243 |
| 240 // Show the dialog, unselect both and accept it. | 244 // Show the dialog, unselect both and accept it. |
| 241 StartDialog(); | 245 StartDialog(); |
| 242 EXPECT_EQ(2U, controller()->GetGalleryList().size()); | 246 EXPECT_EQ(2U, controller()->GetGalleryList().size()); |
| 243 controller()->DidToggleGalleryId(scan1, false); | 247 controller()->DidToggleGalleryId(scan_id, false); |
| 244 controller()->DidToggleGalleryId(scan2, false); | 248 controller()->DidToggleGalleryId(auto_id, false); |
| 245 controller()->DialogFinished(true); | 249 controller()->DialogFinished(true); |
| 246 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); | 250 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); |
| 247 | 251 |
| 248 // Show the dialog, leave one selected and accept it. | 252 // Show the dialog, leave one selected and accept it. |
| 249 StartDialog(); | 253 StartDialog(); |
| 250 EXPECT_EQ(2U, controller()->GetGalleryList().size()); | 254 EXPECT_EQ(2U, controller()->GetGalleryList().size()); |
| 251 controller()->DidToggleGalleryId(scan1, false); | 255 controller()->DidToggleGalleryId(scan_id, false); |
| 252 controller()->DialogFinished(true); | 256 controller()->DialogFinished(true); |
| 253 MediaGalleryPrefIdSet permitted = | 257 MediaGalleryPrefIdSet permitted = |
| 254 gallery_prefs()->GalleriesForExtension(*extension()); | 258 gallery_prefs()->GalleriesForExtension(*extension()); |
| 255 ASSERT_EQ(1U, permitted.size()); | 259 ASSERT_EQ(1U, permitted.size()); |
| 256 EXPECT_EQ(scan2, *permitted.begin()); | 260 EXPECT_EQ(auto_id, *permitted.begin()); |
| 257 | 261 |
| 258 // Show the dialog, toggle the remaining entry twice and then accept it. | 262 // Show the dialog, toggle the remaining entry twice and then accept it. |
| 259 StartDialog(); | 263 StartDialog(); |
| 260 EXPECT_EQ(1U, controller()->GetGalleryList().size()); | 264 EXPECT_EQ(1U, controller()->GetGalleryList().size()); |
| 261 controller()->DidToggleGalleryId(scan1, false); | 265 controller()->DidToggleGalleryId(scan_id, false); |
| 262 controller()->DidToggleGalleryId(scan1, true); | 266 controller()->DidToggleGalleryId(scan_id, true); |
| 263 controller()->DialogFinished(true); | 267 controller()->DialogFinished(true); |
| 264 EXPECT_EQ(2U, gallery_prefs()->GalleriesForExtension(*extension()).size()); | 268 EXPECT_EQ(2U, gallery_prefs()->GalleriesForExtension(*extension()).size()); |
| 265 } | 269 } |
| 266 | 270 |
| 267 TEST_F(MediaGalleriesScanResultDialogControllerTest, Blacklisted) { | 271 TEST_F(MediaGalleriesScanResultDialogControllerTest, Blacklisted) { |
| 268 // Start with two scan results. | 272 // Start with two scan results. |
| 269 MediaGalleryPrefId scan1 = | 273 MediaGalleryPrefId scan_id = AddScanResult("scan_id", 1, 0, 0); |
| 270 gallery_prefs()->AddGalleryByPath(MakeMediaGalleriesTestingPath("scan1"), | 274 MediaGalleryPrefId auto_id = |
| 271 MediaGalleryPrefInfo::kScanResult); | 275 AddGallery("auto_id", MediaGalleryPrefInfo::kAutoDetected, 2, 0, 0); |
| 272 MediaGalleryPrefId scan2 = | |
| 273 gallery_prefs()->AddGalleryByPath(MakeMediaGalleriesTestingPath("scan2"), | |
| 274 MediaGalleryPrefInfo::kScanResult); | |
| 275 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); | 276 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); |
| 276 | 277 |
| 277 // Show the dialog, but cancel it. | 278 // Show the dialog, but cancel it. |
| 278 StartDialog(); | 279 StartDialog(); |
| 279 EXPECT_EQ(2U, controller()->GetGalleryList().size()); | 280 EXPECT_EQ(2U, controller()->GetGalleryList().size()); |
| 280 controller()->DialogFinished(false); | 281 controller()->DialogFinished(false); |
| 281 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); | 282 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); |
| 282 | 283 |
| 283 // Blacklist one and try again. | 284 // Blacklist one and try again. |
| 284 gallery_prefs()->ForgetGalleryById(scan2); | 285 gallery_prefs()->ForgetGalleryById(scan_id); |
| 285 StartDialog(); | 286 StartDialog(); |
| 286 EXPECT_EQ(1U, controller()->GetGalleryList().size()); | 287 EXPECT_EQ(1U, controller()->GetGalleryList().size()); |
| 287 controller()->DialogFinished(false); | 288 controller()->DialogFinished(false); |
| 288 | 289 |
| 289 // Adding it as a user gallery should change its type. | 290 // Adding it as a user gallery should change its type. |
| 290 gallery_prefs()->AddGalleryByPath(MakeMediaGalleriesTestingPath("scan2"), | 291 AddGallery("scan_id", MediaGalleryPrefInfo::kUserAdded, 1, 0, 0); |
| 291 MediaGalleryPrefInfo::kUserAdded); | |
| 292 StartDialog(); | 292 StartDialog(); |
| 293 EXPECT_EQ(1U, controller()->GetGalleryList().size()); | 293 EXPECT_EQ(2U, controller()->GetGalleryList().size()); |
| 294 | 294 |
| 295 // Blacklisting the other while the dialog is open should remove it. | 295 // Blacklisting the other while the dialog is open should remove it. |
| 296 gallery_prefs()->ForgetGalleryById(scan1); | 296 gallery_prefs()->ForgetGalleryById(auto_id); |
| 297 EXPECT_EQ(0U, controller()->GetGalleryList().size()); | 297 EXPECT_EQ(1U, controller()->GetGalleryList().size()); |
| 298 controller()->DialogFinished(false); | 298 controller()->DialogFinished(false); |
| 299 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); | 299 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); |
| 300 EXPECT_EQ(1, dialog_update_count_at_destruction()); | 300 EXPECT_EQ(1, dialog_update_count_at_destruction()); |
| 301 } | 301 } |
| 302 | 302 |
| 303 TEST_F(MediaGalleriesScanResultDialogControllerTest, PrefUpdates) { | 303 TEST_F(MediaGalleriesScanResultDialogControllerTest, PrefUpdates) { |
| 304 MediaGalleryPrefId selected = gallery_prefs()->AddGalleryByPath( | 304 MediaGalleryPrefId selected = AddScanResult("selected", 1, 0, 0); |
| 305 MakeMediaGalleriesTestingPath("selected"), | 305 MediaGalleryPrefId unselected = AddScanResult("unselected", 1, 0, 0); |
| 306 MediaGalleryPrefInfo::kScanResult); | |
| 307 MediaGalleryPrefId unselected = gallery_prefs()->AddGalleryByPath( | |
| 308 MakeMediaGalleriesTestingPath("unselected"), | |
| 309 MediaGalleryPrefInfo::kScanResult); | |
| 310 MediaGalleryPrefId selected_add_permission = | 306 MediaGalleryPrefId selected_add_permission = |
| 311 gallery_prefs()->AddGalleryByPath( | 307 AddScanResult("selected_add_permission", 1, 0, 0); |
| 312 MakeMediaGalleriesTestingPath("selected_add_permission"), | |
| 313 MediaGalleryPrefInfo::kScanResult); | |
| 314 MediaGalleryPrefId unselected_add_permission = | 308 MediaGalleryPrefId unselected_add_permission = |
| 315 gallery_prefs()->AddGalleryByPath( | 309 AddScanResult("unselected_add_permission", 1, 0, 0); |
| 316 MakeMediaGalleriesTestingPath("unselected_add_permission"), | 310 MediaGalleryPrefId selected_removed = |
| 317 MediaGalleryPrefInfo::kScanResult); | 311 AddScanResult("selected_removed", 1, 0, 0); |
| 318 MediaGalleryPrefId selected_removed = gallery_prefs()->AddGalleryByPath( | 312 MediaGalleryPrefId unselected_removed = |
| 319 MakeMediaGalleriesTestingPath("selected_removed"), | 313 AddScanResult("unselected_removed", 1, 0, 0); |
| 320 MediaGalleryPrefInfo::kScanResult); | 314 MediaGalleryPrefId selected_update = |
| 321 MediaGalleryPrefId unselected_removed = gallery_prefs()->AddGalleryByPath( | 315 AddScanResult("selected_update", 1, 0, 0); |
| 322 MakeMediaGalleriesTestingPath("unselected_removed"), | 316 MediaGalleryPrefId unselected_update = |
| 323 MediaGalleryPrefInfo::kScanResult); | 317 AddScanResult("unselected_update", 1, 0, 0); |
| 324 MediaGalleryPrefId selected_update = gallery_prefs()->AddGalleryByPath( | |
| 325 MakeMediaGalleriesTestingPath("selected_update"), | |
| 326 MediaGalleryPrefInfo::kScanResult); | |
| 327 MediaGalleryPrefId unselected_update = gallery_prefs()->AddGalleryByPath( | |
| 328 MakeMediaGalleriesTestingPath("unselected_update"), | |
| 329 MediaGalleryPrefInfo::kScanResult); | |
| 330 | 318 |
| 331 gallery_prefs()->AddGalleryByPath(MakeMediaGalleriesTestingPath("user"), | 319 gallery_prefs()->AddGalleryByPath(MakeMediaGalleriesTestingPath("user"), |
| 332 MediaGalleryPrefInfo::kUserAdded); | 320 MediaGalleryPrefInfo::kUserAdded); |
| 333 gallery_prefs()->AddGalleryByPath( | 321 gallery_prefs()->AddGalleryByPath( |
| 334 MakeMediaGalleriesTestingPath("auto_detected"), | 322 MakeMediaGalleriesTestingPath("auto_detected"), |
| 335 MediaGalleryPrefInfo::kAutoDetected); | 323 MediaGalleryPrefInfo::kAutoDetected); |
| 336 MediaGalleryPrefId blacklisted = gallery_prefs()->AddGalleryByPath( | 324 MediaGalleryPrefId blacklisted = gallery_prefs()->AddGalleryByPath( |
| 337 MakeMediaGalleriesTestingPath("blacklisted"), | 325 MakeMediaGalleriesTestingPath("blacklisted"), |
| 338 MediaGalleryPrefInfo::kAutoDetected); | 326 MediaGalleryPrefInfo::kAutoDetected); |
| 339 gallery_prefs()->ForgetGalleryById(blacklisted); | 327 gallery_prefs()->ForgetGalleryById(blacklisted); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 | 393 |
| 406 controller()->DialogFinished(true); | 394 controller()->DialogFinished(true); |
| 407 EXPECT_EQ(4U, gallery_prefs()->GalleriesForExtension(*extension()).size()); | 395 EXPECT_EQ(4U, gallery_prefs()->GalleriesForExtension(*extension()).size()); |
| 408 StartDialog(); | 396 StartDialog(); |
| 409 EXPECT_EQ(2U, controller()->GetGalleryList().size()); | 397 EXPECT_EQ(2U, controller()->GetGalleryList().size()); |
| 410 controller()->DialogFinished(false); | 398 controller()->DialogFinished(false); |
| 411 } | 399 } |
| 412 | 400 |
| 413 TEST_F(MediaGalleriesScanResultDialogControllerTest, ForgetGallery) { | 401 TEST_F(MediaGalleriesScanResultDialogControllerTest, ForgetGallery) { |
| 414 // Start with two scan results. | 402 // Start with two scan results. |
| 415 MediaGalleryPrefId scan1 = | 403 MediaGalleryPrefId scan1 = AddScanResult("scan1", 1, 0, 0); |
| 416 gallery_prefs()->AddGalleryByPath(MakeMediaGalleriesTestingPath("scan1"), | 404 MediaGalleryPrefId scan2 = AddScanResult("scan2", 2, 0, 0); |
| 417 MediaGalleryPrefInfo::kScanResult); | |
| 418 MediaGalleryPrefId scan2 = | |
| 419 gallery_prefs()->AddGalleryByPath(MakeMediaGalleriesTestingPath("scan2"), | |
| 420 MediaGalleryPrefInfo::kScanResult); | |
| 421 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); | 405 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); |
| 422 | 406 |
| 423 // Remove one and then cancel. | 407 // Remove one and then cancel. |
| 424 StartDialog(); | 408 StartDialog(); |
| 425 EXPECT_EQ(2U, controller()->GetGalleryList().size()); | 409 EXPECT_EQ(2U, controller()->GetGalleryList().size()); |
| 426 controller()->DidForgetGallery(scan1); | 410 controller()->DidForgetGallery(scan1); |
| 427 controller()->DialogFinished(false); | 411 controller()->DialogFinished(false); |
| 428 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); | 412 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); |
| 429 | 413 |
| 430 // Remove one and then have it blacklisted from prefs. | 414 // Remove one and then have it blacklisted from prefs. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 445 controller()->DialogFinished(true); | 429 controller()->DialogFinished(true); |
| 446 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); | 430 EXPECT_EQ(0U, gallery_prefs()->GalleriesForExtension(*extension()).size()); |
| 447 | 431 |
| 448 // Check that nothing shows up. | 432 // Check that nothing shows up. |
| 449 StartDialog(); | 433 StartDialog(); |
| 450 EXPECT_EQ(0U, controller()->GetGalleryList().size()); | 434 EXPECT_EQ(0U, controller()->GetGalleryList().size()); |
| 451 controller()->DialogFinished(false); | 435 controller()->DialogFinished(false); |
| 452 } | 436 } |
| 453 | 437 |
| 454 TEST_F(MediaGalleriesScanResultDialogControllerTest, SortOrder) { | 438 TEST_F(MediaGalleriesScanResultDialogControllerTest, SortOrder) { |
| 455 // Intentionally our of order numerically and alphabetically. | 439 // Intentionally out of order numerically and alphabetically. |
| 456 MediaGalleryPrefId third = AddScanResult(gallery_prefs(), "third", 2, 2, 2); | 440 MediaGalleryPrefId third = AddScanResult("third", 2, 2, 2); |
| 457 MediaGalleryPrefId second = AddScanResult(gallery_prefs(), "second", 9, 0, 0); | 441 MediaGalleryPrefId second = |
| 458 MediaGalleryPrefId first = AddScanResult(gallery_prefs(), "first", 8, 2, 3); | 442 AddGallery("second", MediaGalleryPrefInfo::kAutoDetected, 9, 0, 0); |
| 459 MediaGalleryPrefId fifth = AddScanResult(gallery_prefs(), "abb", 3, 0, 0); | 443 MediaGalleryPrefId first = AddScanResult("first", 8, 2, 3); |
| 460 MediaGalleryPrefId fourth = AddScanResult(gallery_prefs(), "aaa", 3, 0, 0); | 444 MediaGalleryPrefId fifth = AddScanResult("abb", 3, 0, 0); |
| 445 MediaGalleryPrefId fourth = AddScanResult("aaa", 3, 0, 0); |
| 461 | 446 |
| 462 StartDialog(); | 447 StartDialog(); |
| 463 MediaGalleriesScanResultDialogController::OrderedScanResults results = | 448 MediaGalleriesScanResultDialogController::OrderedScanResults results = |
| 464 controller()->GetGalleryList(); | 449 controller()->GetGalleryList(); |
| 465 ASSERT_EQ(5U, results.size()); | 450 ASSERT_EQ(5U, results.size()); |
| 466 EXPECT_EQ(first, results[0].pref_info.pref_id); | 451 EXPECT_EQ(first, results[0].pref_info.pref_id); |
| 467 EXPECT_EQ(second, results[1].pref_info.pref_id); | 452 EXPECT_EQ(second, results[1].pref_info.pref_id); |
| 468 EXPECT_EQ(third, results[2].pref_info.pref_id); | 453 EXPECT_EQ(third, results[2].pref_info.pref_id); |
| 469 EXPECT_EQ(fourth, results[3].pref_info.pref_id); | 454 EXPECT_EQ(fourth, results[3].pref_info.pref_id); |
| 470 EXPECT_EQ(fifth, results[4].pref_info.pref_id); | 455 EXPECT_EQ(fifth, results[4].pref_info.pref_id); |
| 471 controller()->DialogFinished(false); | 456 controller()->DialogFinished(false); |
| 472 } | 457 } |
| OLD | NEW |