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 #include "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 #endif | 39 #endif |
40 | 40 |
41 const char kTestGalleries[] = "testGalleries(%d)"; | 41 const char kTestGalleries[] = "testGalleries(%d)"; |
42 | 42 |
43 } // namespace | 43 } // namespace |
44 | 44 |
45 // This function is to ensure at least one (fake) media gallery exists for | 45 // This function is to ensure at least one (fake) media gallery exists for |
46 // testing platforms with no default media galleries, such as CHROMEOS. | 46 // testing platforms with no default media galleries, such as CHROMEOS. |
47 void MakeFakeMediaGalleryForTest(Profile* profile, const base::FilePath& path) { | 47 void MakeFakeMediaGalleryForTest(Profile* profile, const base::FilePath& path) { |
48 base::RunLoop runloop; | 48 base::RunLoop runloop; |
49 StorageMonitor::GetInstance()->EnsureInitialized(runloop.QuitClosure()); | |
50 runloop.Run(); | |
51 | |
52 MediaGalleriesPreferences* preferences = | 49 MediaGalleriesPreferences* preferences = |
53 g_browser_process->media_file_system_registry()->GetPreferences(profile); | 50 g_browser_process->media_file_system_registry()->GetPreferences(profile); |
| 51 preferences->EnsureInitialized(runloop.QuitClosure()); |
| 52 runloop.Run(); |
54 | 53 |
55 MediaGalleryPrefInfo gallery_info; | 54 MediaGalleryPrefInfo gallery_info; |
56 ASSERT_FALSE(preferences->LookUpGalleryByPath(path, &gallery_info)); | 55 ASSERT_FALSE(preferences->LookUpGalleryByPath(path, &gallery_info)); |
57 preferences->AddGallery(gallery_info.device_id, | 56 preferences->AddGallery(gallery_info.device_id, |
58 gallery_info.path, | 57 gallery_info.path, |
59 false /* user_added */, | 58 false /* user_added */, |
60 gallery_info.volume_label, | 59 gallery_info.volume_label, |
61 gallery_info.vendor_name, | 60 gallery_info.vendor_name, |
62 gallery_info.model_name, | 61 gallery_info.model_name, |
63 gallery_info.total_size_in_bytes, | 62 gallery_info.total_size_in_bytes, |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 "testGalleries(%d, \"%s\")", num_galleries() + 1, kDeviceName)); | 193 "testGalleries(%d, \"%s\")", num_galleries() + 1, kDeviceName)); |
195 | 194 |
196 DetachFakeDevice(); | 195 DetachFakeDevice(); |
197 } | 196 } |
198 | 197 |
199 IN_PROC_BROWSER_TEST_F(MediaGalleriesPlatformAppBrowserTest, | 198 IN_PROC_BROWSER_TEST_F(MediaGalleriesPlatformAppBrowserTest, |
200 GetFilesystemMetadata) { | 199 GetFilesystemMetadata) { |
201 ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/metadata")) | 200 ASSERT_TRUE(RunPlatformAppTest("api_test/media_galleries/metadata")) |
202 << message_; | 201 << message_; |
203 } | 202 } |
OLD | NEW |