Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / storage_monitor / storage_info_unittest.cc
blob36229c5699d9944b9296d44cd22d9f3eda763542
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.
5 #include <string>
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
23 // mtp device id.
24 TEST(StorageInfoTest, CrackMtpDeviceId) {
25 StorageInfo::Type type;
26 std::string id;
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;
34 std::string id;
35 ASSERT_TRUE(StorageInfo::CrackDeviceId(kImageCaptureDeviceId, &type, &id));
36 EXPECT_EQ(StorageInfo::MAC_IMAGE_CAPTURE, type);
37 EXPECT_EQ("xyz", id);