Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: chrome/browser/media_gallery/media_galleries_preferences_unittest.cc

Issue 10913290: Clean up MediaStorageUtil (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_gallery/media_galleries_preferences.h" 7 #include "chrome/browser/media_gallery/media_galleries_preferences.h"
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 18 matching lines...) Expand all
29 29
30 namespace { 30 namespace {
31 31
32 class MediaStorageUtilTest : public MediaStorageUtil { 32 class MediaStorageUtilTest : public MediaStorageUtil {
33 public: 33 public:
34 static void SetTestingMode() { 34 static void SetTestingMode() {
35 SetGetDeviceInfoFromPathFunctionForTesting( 35 SetGetDeviceInfoFromPathFunctionForTesting(
36 &GetDeviceInfoFromPathTestFunction); 36 &GetDeviceInfoFromPathTestFunction);
37 } 37 }
38 38
39 static void GetDeviceInfoFromPathTestFunction(const FilePath& path, 39 static bool GetDeviceInfoFromPathTestFunction(const FilePath& path,
40 std::string* device_id, 40 std::string* device_id,
41 string16* device_name, 41 string16* device_name,
42 FilePath* relative_path) { 42 FilePath* relative_path) {
43 if (device_id) 43 if (device_id)
44 *device_id = MakeDeviceId(FIXED_MASS_STORAGE, path.AsUTF8Unsafe()); 44 *device_id = MakeDeviceId(FIXED_MASS_STORAGE, path.AsUTF8Unsafe());
45 if (device_name) 45 if (device_name)
46 *device_name = path.BaseName().LossyDisplayName(); 46 *device_name = path.BaseName().LossyDisplayName();
47 if (relative_path) 47 if (relative_path)
48 *relative_path = FilePath(); 48 *relative_path = FilePath();
49 return true;
49 } 50 }
50 }; 51 };
51 52
52 class MediaGalleriesPreferencesTest : public testing::Test { 53 class MediaGalleriesPreferencesTest : public testing::Test {
53 public: 54 public:
54 typedef std::map<std::string /*device id*/, MediaGalleryPrefIdSet> 55 typedef std::map<std::string /*device id*/, MediaGalleryPrefIdSet>
55 DeviceIdPrefIdsMap; 56 DeviceIdPrefIdsMap;
56 57
57 MediaGalleriesPreferencesTest() 58 MediaGalleriesPreferencesTest()
58 : ui_thread_(content::BrowserThread::UI, &loop_), 59 : ui_thread_(content::BrowserThread::UI, &loop_),
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 // Check that adding one of them again works as expected. 528 // Check that adding one of them again works as expected.
528 MediaGalleryPrefId id = gallery_prefs()->AddGallery( 529 MediaGalleryPrefId id = gallery_prefs()->AddGallery(
529 device_id, device_name, relative_path, true /*user*/); 530 device_id, device_name, relative_path, true /*user*/);
530 EXPECT_EQ(dev2_path2_id, id); 531 EXPECT_EQ(dev2_path2_id, id);
531 Verify(); 532 Verify();
532 } 533 }
533 534
534 } // namespace 535 } // namespace
535 536
536 } // namespace chrome 537 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/media_gallery/media_galleries_preferences.cc ('k') | chrome/browser/system_monitor/media_storage_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698