Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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. | |
| 4 | |
| 5 #include <string> | |
| 6 | |
| 7 #include "chrome/browser/media_gallery/media_storage_util.h" | |
| 8 #include "testing/gtest/include/gtest/gtest.h" | |
| 9 | |
| 10 namespace chrome { | |
| 11 | |
| 12 namespace { | |
| 13 | |
| 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"; | |
| 17 | |
| 18 } // namespace | |
| 19 | |
| 20 // Class to test |MediaStorageUtil| functions. | |
| 21 class MediaStorageUtilTest : public testing::Test { | |
|
Lei Zhang
2012/08/27 18:57:50
Since this is an empty class, just do:
typedef tes
kmadhusu
2012/08/27 20:25:46
Done.
| |
| 22 }; | |
| 23 | |
| 24 // Test to verify |MediaStorageUtil::MakeDeviceId| functionality using a sample | |
| 25 // mtp device unique id. | |
| 26 TEST_F(MediaStorageUtilTest, MakeMtpDeviceId) { | |
| 27 std::string device_id = | |
| 28 MediaStorageUtil::MakeDeviceId(MediaStorageUtil::USB_MTP, kUniqueId); | |
| 29 ASSERT_EQ(device_id, kMtpDeviceId); | |
|
Lei Zhang
2012/08/27 18:57:50
All the ASSERT_EQ()s in this file should have thei
kmadhusu
2012/08/27 20:25:46
Done.
| |
| 30 } | |
| 31 | |
| 32 // Test to verify |MediaStorageUtil::CrackDeviceId| functionality using a sample | |
| 33 // mtp device id. | |
| 34 TEST_F(MediaStorageUtilTest, CrackMtpDeviceId) { | |
| 35 MediaStorageUtil::Type type; | |
| 36 std::string id; | |
| 37 ASSERT_TRUE(MediaStorageUtil::CrackDeviceId(kMtpDeviceId, &type, &id)); | |
| 38 ASSERT_EQ(id, kUniqueId); | |
| 39 ASSERT_EQ(type, MediaStorageUtil::USB_MTP); | |
| 40 } | |
| 41 | |
| 42 } // namespace chrome | |
| OLD | NEW |