OLD | NEW |
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 #include <stdint.h> |
| 6 |
5 #include <string> | 7 #include <string> |
6 | 8 |
7 #include "device/usb/usb_ids.h" | 9 #include "device/usb/usb_ids.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
9 | 11 |
10 namespace { | 12 namespace { |
11 | 13 |
12 static const uint16_t kGoogleVendorId = 0x18d1; | 14 static const uint16_t kGoogleVendorId = 0x18d1; |
13 static const uint16_t kNexusSProductId = 0x4e21; | 15 static const uint16_t kNexusSProductId = 0x4e21; |
14 | 16 |
15 } // namespace | 17 } // namespace |
16 | 18 |
17 namespace device { | 19 namespace device { |
18 | 20 |
19 TEST(UsbIdsTest, GetVendorName) { | 21 TEST(UsbIdsTest, GetVendorName) { |
20 EXPECT_EQ(NULL, UsbIds::GetVendorName(0)); | 22 EXPECT_EQ(NULL, UsbIds::GetVendorName(0)); |
21 EXPECT_EQ(std::string("Google Inc."), UsbIds::GetVendorName(kGoogleVendorId)); | 23 EXPECT_EQ(std::string("Google Inc."), UsbIds::GetVendorName(kGoogleVendorId)); |
22 } | 24 } |
23 | 25 |
24 TEST(UsbIdsTest, GetProductName) { | 26 TEST(UsbIdsTest, GetProductName) { |
25 EXPECT_EQ(NULL, UsbIds::GetProductName(0, 0)); | 27 EXPECT_EQ(NULL, UsbIds::GetProductName(0, 0)); |
26 EXPECT_EQ(NULL, UsbIds::GetProductName(kGoogleVendorId, 0)); | 28 EXPECT_EQ(NULL, UsbIds::GetProductName(kGoogleVendorId, 0)); |
27 EXPECT_EQ(std::string("Nexus S"), UsbIds::GetProductName(kGoogleVendorId, | 29 EXPECT_EQ(std::string("Nexus S"), UsbIds::GetProductName(kGoogleVendorId, |
28 kNexusSProductId)); | 30 kNexusSProductId)); |
29 } | 31 } |
30 | 32 |
31 } // namespace device | 33 } // namespace device |
OLD | NEW |