1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
7 #include "chrome/browser/storage_monitor/storage_info.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 const char kMtpDeviceId
[] = "mtp:VendorModelSerial:ABC:1233:1237912873";
11 const char kUniqueId
[] = "VendorModelSerial:ABC:1233:1237912873";
12 const char kImageCaptureDeviceId
[] = "ic:xyz";
14 // Test to verify |MakeDeviceId| functionality using a sample
15 // mtp device unique id.
16 TEST(StorageInfoTest
, MakeMtpDeviceId
) {
17 std::string device_id
=
18 StorageInfo::MakeDeviceId(StorageInfo::MTP_OR_PTP
, kUniqueId
);
19 ASSERT_EQ(kMtpDeviceId
, device_id
);
22 // Test to verify |CrackDeviceId| functionality using a sample
24 TEST(StorageInfoTest
, CrackMtpDeviceId
) {
25 StorageInfo::Type type
;
27 ASSERT_TRUE(StorageInfo::CrackDeviceId(kMtpDeviceId
, &type
, &id
));
28 EXPECT_EQ(kUniqueId
, id
);
29 EXPECT_EQ(StorageInfo::MTP_OR_PTP
, type
);
32 TEST(StorageInfoTest
, TestImageCaptureDeviceId
) {
33 StorageInfo::Type type
;
35 ASSERT_TRUE(StorageInfo::CrackDeviceId(kImageCaptureDeviceId
, &type
, &id
));
36 EXPECT_EQ(StorageInfo::MAC_IMAGE_CAPTURE
, type
);