Revert 168224 - Update V8 to version 3.15.4.
[chromium-blink-merge.git] / chrome / browser / system_monitor / media_storage_util_unittest.cc
blob175cb781cfaf37bded4fcec05b823e55f8535b15
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
3 // found in the LICENSE file.
5 #include <string>
7 #include "chrome/browser/system_monitor/media_storage_util.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 namespace chrome {
12 namespace {
14 // Sample mtp device id and unique id.
15 const char kMtpDeviceId[] = "mtp:VendorModelSerial:ABC:1233:1237912873";
16 const char kUniqueId[] = "VendorModelSerial:ABC:1233:1237912873";
18 } // namespace
20 typedef testing::Test MediaStorageUtilTest;
22 // Test to verify |MediaStorageUtil::MakeDeviceId| functionality using a sample
23 // mtp device unique id.
24 TEST_F(MediaStorageUtilTest, MakeMtpDeviceId) {
25 std::string device_id =
26 MediaStorageUtil::MakeDeviceId(MediaStorageUtil::MTP_OR_PTP, kUniqueId);
27 ASSERT_EQ(kMtpDeviceId, device_id);
30 // Test to verify |MediaStorageUtil::CrackDeviceId| functionality using a sample
31 // mtp device id.
32 TEST_F(MediaStorageUtilTest, CrackMtpDeviceId) {
33 MediaStorageUtil::Type type;
34 std::string id;
35 ASSERT_TRUE(MediaStorageUtil::CrackDeviceId(kMtpDeviceId, &type, &id));
36 ASSERT_EQ(kUniqueId, id);
37 ASSERT_EQ(MediaStorageUtil::MTP_OR_PTP, type);
40 } // namespace chrome