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 // MediaGalleriesPreferences unit tests. | 5 // MediaGalleriesPreferences unit tests. |
6 | 6 |
7 #include "chrome/browser/media_galleries/media_galleries_preferences.h" | 7 #include "chrome/browser/media_galleries/media_galleries_preferences.h" |
8 | 8 |
| 9 #include <stdint.h> |
| 10 |
9 #include <string> | 11 #include <string> |
10 #include <vector> | 12 #include <vector> |
11 | 13 |
12 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
15 #include "base/path_service.h" | 18 #include "base/path_service.h" |
16 #include "base/prefs/scoped_user_pref_update.h" | 19 #include "base/prefs/scoped_user_pref_update.h" |
17 #include "base/run_loop.h" | 20 #include "base/run_loop.h" |
18 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
19 #include "base/values.h" | 22 #include "base/values.h" |
| 23 #include "build/build_config.h" |
20 #include "chrome/browser/extensions/test_extension_system.h" | 24 #include "chrome/browser/extensions/test_extension_system.h" |
21 #include "chrome/browser/media_galleries/media_file_system_registry.h" | 25 #include "chrome/browser/media_galleries/media_file_system_registry.h" |
22 #include "chrome/browser/media_galleries/media_galleries_test_util.h" | 26 #include "chrome/browser/media_galleries/media_galleries_test_util.h" |
23 #include "chrome/common/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
24 #include "chrome/common/pref_names.h" | 28 #include "chrome/common/pref_names.h" |
25 #include "chrome/grit/generated_resources.h" | 29 #include "chrome/grit/generated_resources.h" |
26 #include "chrome/test/base/testing_profile.h" | 30 #include "chrome/test/base/testing_profile.h" |
27 #include "components/storage_monitor/media_storage_util.h" | 31 #include "components/storage_monitor/media_storage_util.h" |
28 #include "components/storage_monitor/storage_monitor.h" | 32 #include "components/storage_monitor/storage_monitor.h" |
29 #include "components/storage_monitor/test_storage_monitor.h" | 33 #include "components/storage_monitor/test_storage_monitor.h" |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 EXPECT_EQ(in_expectation->second.video_count, actual.video_count); | 257 EXPECT_EQ(in_expectation->second.video_count, actual.video_count); |
254 EXPECT_EQ( | 258 EXPECT_EQ( |
255 in_expectation->second.default_gallery_type, | 259 in_expectation->second.default_gallery_type, |
256 actual.default_gallery_type); | 260 actual.default_gallery_type); |
257 } | 261 } |
258 | 262 |
259 MediaGalleriesPreferences* gallery_prefs() { | 263 MediaGalleriesPreferences* gallery_prefs() { |
260 return gallery_prefs_.get(); | 264 return gallery_prefs_.get(); |
261 } | 265 } |
262 | 266 |
263 uint64 default_galleries_count() { | 267 uint64_t default_galleries_count() { return default_galleries_count_; } |
264 return default_galleries_count_; | |
265 } | |
266 | 268 |
267 void AddGalleryExpectation(MediaGalleryPrefId id, base::string16 display_name, | 269 void AddGalleryExpectation(MediaGalleryPrefId id, base::string16 display_name, |
268 std::string device_id, | 270 std::string device_id, |
269 base::FilePath relative_path, | 271 base::FilePath relative_path, |
270 MediaGalleryPrefInfo::Type type) { | 272 MediaGalleryPrefInfo::Type type) { |
271 expected_galleries_[id].pref_id = id; | 273 expected_galleries_[id].pref_id = id; |
272 expected_galleries_[id].display_name = display_name; | 274 expected_galleries_[id].display_name = display_name; |
273 expected_galleries_[id].device_id = device_id; | 275 expected_galleries_[id].device_id = device_id; |
274 expected_galleries_[id].path = relative_path.NormalizePathSeparators(); | 276 expected_galleries_[id].path = relative_path.NormalizePathSeparators(); |
275 expected_galleries_[id].type = type; | 277 expected_galleries_[id].type = type; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 #if defined(OS_CHROMEOS) | 372 #if defined(OS_CHROMEOS) |
371 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 373 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
372 chromeos::ScopedTestCrosSettings test_cros_settings_; | 374 chromeos::ScopedTestCrosSettings test_cros_settings_; |
373 chromeos::ScopedTestUserManager test_user_manager_; | 375 chromeos::ScopedTestUserManager test_user_manager_; |
374 #endif | 376 #endif |
375 | 377 |
376 TestStorageMonitor monitor_; | 378 TestStorageMonitor monitor_; |
377 scoped_ptr<TestingProfile> profile_; | 379 scoped_ptr<TestingProfile> profile_; |
378 scoped_ptr<MediaGalleriesPreferences> gallery_prefs_; | 380 scoped_ptr<MediaGalleriesPreferences> gallery_prefs_; |
379 | 381 |
380 uint64 default_galleries_count_; | 382 uint64_t default_galleries_count_; |
381 | 383 |
382 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferencesTest); | 384 DISALLOW_COPY_AND_ASSIGN(MediaGalleriesPreferencesTest); |
383 }; | 385 }; |
384 | 386 |
385 TEST_F(MediaGalleriesPreferencesTest, GalleryManagement) { | 387 TEST_F(MediaGalleriesPreferencesTest, GalleryManagement) { |
386 MediaGalleryPrefId auto_id, user_added_id, scan_id, id; | 388 MediaGalleryPrefId auto_id, user_added_id, scan_id, id; |
387 base::FilePath path; | 389 base::FilePath path; |
388 base::FilePath relative_path; | 390 base::FilePath relative_path; |
389 Verify(); | 391 Verify(); |
390 | 392 |
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1525 MediaGalleryPrefInfo::DefaultGalleryType::kNotDefault) { | 1527 MediaGalleryPrefInfo::DefaultGalleryType::kNotDefault) { |
1526 found_user_added = true; | 1528 found_user_added = true; |
1527 } | 1529 } |
1528 } | 1530 } |
1529 | 1531 |
1530 EXPECT_TRUE(found_music); | 1532 EXPECT_TRUE(found_music); |
1531 EXPECT_TRUE(found_pictures); | 1533 EXPECT_TRUE(found_pictures); |
1532 EXPECT_TRUE(found_videos); | 1534 EXPECT_TRUE(found_videos); |
1533 EXPECT_TRUE(found_user_added); | 1535 EXPECT_TRUE(found_user_added); |
1534 } | 1536 } |
OLD | NEW |