Fix a type mismatch on Windows caused by r201738.
[chromium-blink-merge.git] / device / bluetooth / bluetooth_utils_unittest.cc
blob46d5f34a848d9f3c97f848e448390d2a52e4644d
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 "base/basictypes.h"
6 #include "device/bluetooth/bluetooth_utils.h"
7 #include "testing/gtest/include/gtest/gtest.h"
9 namespace device {
11 TEST(BluetoothUtilsTest, CanonicalUuid) {
12 // Does nothing for an already canonical UUID
13 EXPECT_EQ("00001101-0000-1000-8000-00805f9b34fb",
14 bluetooth_utils::CanonicalUuid("00001101-0000-1000-8000-00805f9b34fb"));
16 // Rejects misformatted
17 EXPECT_EQ("", bluetooth_utils::CanonicalUuid("1101a"));
18 EXPECT_EQ("", bluetooth_utils::CanonicalUuid("Z101"));
19 EXPECT_EQ("", bluetooth_utils::CanonicalUuid("0000-1101"));
20 EXPECT_EQ("", bluetooth_utils::CanonicalUuid("0000Z101"));
21 EXPECT_EQ("",
22 bluetooth_utils::CanonicalUuid("0001101-0000-1000-8000-00805f9b34fb"));
23 EXPECT_EQ("",
24 bluetooth_utils::CanonicalUuid("Z0001101-0000-1000-8000-00805f9b34fb"));
25 EXPECT_EQ("",
26 bluetooth_utils::CanonicalUuid("00001101 0000-1000-8000-00805f9b34fb"));
27 EXPECT_EQ("",
28 bluetooth_utils::CanonicalUuid("00001101-0000:1000-8000-00805f9b34fb"));
29 EXPECT_EQ("",
30 bluetooth_utils::CanonicalUuid("00001101-0000-1000;8000-00805f9b34fb"));
31 EXPECT_EQ("",
32 bluetooth_utils::CanonicalUuid("00001101-0000-1000-8000000805f9b34fb"));
34 // Lower case
35 EXPECT_EQ("00001101-0000-1000-8000-00805f9b34fb",
36 bluetooth_utils::CanonicalUuid("00001101-0000-1000-8000-00805F9B34FB"));
38 // Short to full
39 EXPECT_EQ("00001101-0000-1000-8000-00805f9b34fb",
40 bluetooth_utils::CanonicalUuid("1101"));
41 EXPECT_EQ("00001101-0000-1000-8000-00805f9b34fb",
42 bluetooth_utils::CanonicalUuid("0x1101"));
43 EXPECT_EQ("00001101-0000-1000-8000-00805f9b34fb",
44 bluetooth_utils::CanonicalUuid("00001101"));
45 EXPECT_EQ("00001101-0000-1000-8000-00805f9b34fb",
46 bluetooth_utils::CanonicalUuid("0x00001101"));
48 // No 0x prefix on 36 character
49 EXPECT_EQ("",
50 bluetooth_utils::CanonicalUuid("0x00001101-0000-1000-8000-00805f9b34fb"));
53 } // namespace device