| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // MediaFileSystemRegistry unit tests. | 5 // MediaFileSystemRegistry unit tests. |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 | 353 |
| 354 void CheckNewGalleryInfo(ProfileState* profile_state, | 354 void CheckNewGalleryInfo(ProfileState* profile_state, |
| 355 const FSInfoMap& galleries_info, | 355 const FSInfoMap& galleries_info, |
| 356 const base::FilePath& location, | 356 const base::FilePath& location, |
| 357 bool removable, | 357 bool removable, |
| 358 bool media_device); | 358 bool media_device); |
| 359 | 359 |
| 360 std::vector<MediaFileSystemInfo> GetAutoAddedGalleries( | 360 std::vector<MediaFileSystemInfo> GetAutoAddedGalleries( |
| 361 ProfileState* profile_state); | 361 ProfileState* profile_state); |
| 362 | 362 |
| 363 // TODO(gbillock): Rework these once windows-specific code is gone. |
| 363 void ProcessAttach(const std::string& id, | 364 void ProcessAttach(const std::string& id, |
| 364 const string16& name, | 365 const string16& name, |
| 365 const base::FilePath::StringType& location) { | 366 const base::FilePath::StringType& location) { |
| 366 RemovableStorageNotifications::GetInstance()->ProcessAttach( | 367 RemovableStorageNotifications::GetInstance()->receiver()->ProcessAttach( |
| 367 id, name, location); | 368 id, name, location); |
| 368 } | 369 } |
| 369 | 370 |
| 370 void ProcessDetach(const std::string& id) { | 371 void ProcessDetach(const std::string& id) { |
| 371 RemovableStorageNotifications::GetInstance()->ProcessDetach(id); | 372 RemovableStorageNotifications::GetInstance()->receiver()->ProcessDetach(id); |
| 372 } | 373 } |
| 373 | 374 |
| 374 protected: | 375 protected: |
| 375 virtual void SetUp() OVERRIDE; | 376 virtual void SetUp() OVERRIDE; |
| 376 virtual void TearDown() OVERRIDE; | 377 virtual void TearDown() OVERRIDE; |
| 377 | 378 |
| 378 private: | 379 private: |
| 379 // This makes sure that at least one default gallery exists on the file | 380 // This makes sure that at least one default gallery exists on the file |
| 380 // system. | 381 // system. |
| 381 EnsureMediaDirectoriesExists media_directories_; | 382 EnsureMediaDirectoriesExists media_directories_; |
| 382 | 383 |
| 383 // Some test gallery directories. | 384 // Some test gallery directories. |
| 384 base::ScopedTempDir galleries_dir_; | 385 base::ScopedTempDir galleries_dir_; |
| 385 // An empty directory in |galleries_dir_| | 386 // An empty directory in |galleries_dir_| |
| 386 base::FilePath empty_dir_; | 387 base::FilePath empty_dir_; |
| 387 // A directory in |galleries_dir_| with a DCIM directory in it. | 388 // A directory in |galleries_dir_| with a DCIM directory in it. |
| 388 base::FilePath dcim_dir_; | 389 base::FilePath dcim_dir_; |
| 389 | 390 |
| 390 // MediaFileSystemRegistry owns this. | 391 // MediaFileSystemRegistry owns this. |
| 391 TestMediaFileSystemContext* test_file_system_context_; | 392 TestMediaFileSystemContext* test_file_system_context_; |
| 392 | 393 |
| 393 // Needed for extension service & friends to work. | 394 // Needed for extension service & friends to work. |
| 394 content::TestBrowserThread ui_thread_; | 395 content::TestBrowserThread ui_thread_; |
| 395 content::TestBrowserThread file_thread_; | 396 content::TestBrowserThread file_thread_; |
| 396 | 397 |
| 398 // TODO(gbillock): Eliminate windows-specific code from this test. |
| 397 #if defined(OS_WIN) | 399 #if defined(OS_WIN) |
| 398 scoped_ptr<test::TestRemovableDeviceNotificationsWindowWin> window_; | 400 scoped_ptr<test::TestRemovableDeviceNotificationsWindowWin> window_; |
| 399 #else | 401 #else |
| 400 chrome::test::TestRemovableStorageNotifications notifications_; | 402 chrome::test::TestRemovableStorageNotifications notifications_; |
| 401 #endif | 403 #endif |
| 402 | 404 |
| 403 MockProfileSharedRenderProcessHostFactory rph_factory_; | 405 MockProfileSharedRenderProcessHostFactory rph_factory_; |
| 404 | 406 |
| 405 ScopedVector<ProfileState> profile_states_; | 407 ScopedVector<ProfileState> profile_states_; |
| 406 | 408 |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 pref_info_with_relpath.device_id = device_id; | 963 pref_info_with_relpath.device_id = device_id; |
| 962 EXPECT_EQ(dcim_dir().Append(pref_info_with_relpath.path).value(), | 964 EXPECT_EQ(dcim_dir().Append(pref_info_with_relpath.path).value(), |
| 963 pref_info_with_relpath.AbsolutePath().value()); | 965 pref_info_with_relpath.AbsolutePath().value()); |
| 964 | 966 |
| 965 DetachDevice(device_id); | 967 DetachDevice(device_id); |
| 966 EXPECT_TRUE(pref_info.AbsolutePath().empty()); | 968 EXPECT_TRUE(pref_info.AbsolutePath().empty()); |
| 967 EXPECT_TRUE(pref_info_with_relpath.AbsolutePath().empty()); | 969 EXPECT_TRUE(pref_info_with_relpath.AbsolutePath().empty()); |
| 968 } | 970 } |
| 969 | 971 |
| 970 } // namespace chrome | 972 } // namespace chrome |
| OLD | NEW |