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

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

Issue 120303003: [StorageMonitor] Move gallery name generation to StorageInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 7 years 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
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_galleries/media_galleries_preferences.h" 7 #include "chrome/browser/media_galleries/media_galleries_preferences.h"
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 835
836 TEST(MediaGalleryPrefInfoTest, NameGeneration) { 836 TEST(MediaGalleryPrefInfoTest, NameGeneration) {
837 ASSERT_TRUE(TestStorageMonitor::CreateAndInstall()); 837 ASSERT_TRUE(TestStorageMonitor::CreateAndInstall());
838 838
839 MediaGalleryPrefInfo info; 839 MediaGalleryPrefInfo info;
840 info.pref_id = 1; 840 info.pref_id = 1;
841 info.display_name = ASCIIToUTF16("override"); 841 info.display_name = ASCIIToUTF16("override");
842 info.device_id = StorageInfo::MakeDeviceId( 842 info.device_id = StorageInfo::MakeDeviceId(
843 StorageInfo::REMOVABLE_MASS_STORAGE_WITH_DCIM, "unique"); 843 StorageInfo::REMOVABLE_MASS_STORAGE_WITH_DCIM, "unique");
844 844
845 EXPECT_EQ(ASCIIToUTF16("override"), info.GetGalleryDisplayName());
846
847 info.display_name = ASCIIToUTF16("o2");
848 EXPECT_EQ(ASCIIToUTF16("o2"), info.GetGalleryDisplayName());
849
850 EXPECT_EQ(l10n_util::GetStringUTF16( 845 EXPECT_EQ(l10n_util::GetStringUTF16(
851 IDS_MEDIA_GALLERIES_DIALOG_DEVICE_NOT_ATTACHED), 846 IDS_MEDIA_GALLERIES_DIALOG_DEVICE_NOT_ATTACHED),
852 info.GetGalleryAdditionalDetails()); 847 info.GetGalleryAdditionalDetails());
853 848
854 info.last_attach_time = base::Time::Now(); 849 info.last_attach_time = base::Time::Now();
855 EXPECT_NE(l10n_util::GetStringUTF16( 850 EXPECT_NE(l10n_util::GetStringUTF16(
856 IDS_MEDIA_GALLERIES_DIALOG_DEVICE_NOT_ATTACHED), 851 IDS_MEDIA_GALLERIES_DIALOG_DEVICE_NOT_ATTACHED),
857 info.GetGalleryAdditionalDetails()); 852 info.GetGalleryAdditionalDetails());
858 EXPECT_NE(l10n_util::GetStringUTF16( 853 EXPECT_NE(l10n_util::GetStringUTF16(
859 IDS_MEDIA_GALLERIES_DIALOG_DEVICE_ATTACHED), 854 IDS_MEDIA_GALLERIES_DIALOG_DEVICE_ATTACHED),
860 info.GetGalleryAdditionalDetails()); 855 info.GetGalleryAdditionalDetails());
861 856
862 info.volume_label = ASCIIToUTF16("vol");
863 info.vendor_name = ASCIIToUTF16("vendor");
864 info.model_name = ASCIIToUTF16("model");
865 EXPECT_EQ(ASCIIToUTF16("o2"), info.GetGalleryDisplayName());
866
867 info.display_name = string16();
868 EXPECT_EQ(ASCIIToUTF16("vol"), info.GetGalleryDisplayName());
869 info.volume_label = string16();
870 EXPECT_EQ(ASCIIToUTF16("vendor, model"), info.GetGalleryDisplayName());
871
872 info.device_id = StorageInfo::MakeDeviceId( 857 info.device_id = StorageInfo::MakeDeviceId(
873 StorageInfo::FIXED_MASS_STORAGE, "unique"); 858 StorageInfo::FIXED_MASS_STORAGE, "unique");
874 EXPECT_EQ(base::FilePath(FILE_PATH_LITERAL("unique")).AsUTF8Unsafe(), 859 EXPECT_EQ(base::FilePath(FILE_PATH_LITERAL("unique")).AsUTF8Unsafe(),
875 UTF16ToUTF8(info.GetGalleryTooltip())); 860 UTF16ToUTF8(info.GetGalleryTooltip()));
876 861
877 TestStorageMonitor::RemoveSingleton(); 862 TestStorageMonitor::RemoveSingleton();
878 } 863 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698