Hotlist Slow: Remove extra thread pool created by VolumeMountWatcherWin.
[chromium-blink-merge.git] / components / wifi_sync / wifi_security_class_unittest.cc
blobb5652bb3322f1b68bd7104028754367d05fe66e4
1 // Copyright 2015 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 "components/wifi_sync/wifi_security_class.h"
7 #include "components/onc/onc_constants.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 namespace wifi_sync {
12 TEST(WifiSecurityClassTest, WifiSecurityClassSupportsPassphrases) {
13 EXPECT_FALSE(WifiSecurityClassSupportsPassphrases(SECURITY_CLASS_NONE));
14 EXPECT_TRUE(WifiSecurityClassSupportsPassphrases(SECURITY_CLASS_WEP));
15 EXPECT_TRUE(WifiSecurityClassSupportsPassphrases(SECURITY_CLASS_PSK));
16 EXPECT_TRUE(WifiSecurityClassSupportsPassphrases(SECURITY_CLASS_802_1X));
17 EXPECT_FALSE(WifiSecurityClassSupportsPassphrases(SECURITY_CLASS_INVALID));
20 TEST(WifiSecurityClassTest, WifiSecurityClassFromSyncSecurityClass) {
21 EXPECT_EQ(SECURITY_CLASS_NONE,
22 WifiSecurityClassFromSyncSecurityClass(
23 sync_pb::WifiCredentialSpecifics::SECURITY_CLASS_NONE));
24 EXPECT_EQ(SECURITY_CLASS_WEP,
25 WifiSecurityClassFromSyncSecurityClass(
26 sync_pb::WifiCredentialSpecifics::SECURITY_CLASS_WEP));
27 EXPECT_EQ(SECURITY_CLASS_PSK,
28 WifiSecurityClassFromSyncSecurityClass(
29 sync_pb::WifiCredentialSpecifics::SECURITY_CLASS_PSK));
30 EXPECT_EQ(SECURITY_CLASS_INVALID,
31 WifiSecurityClassFromSyncSecurityClass(
32 sync_pb::WifiCredentialSpecifics::SECURITY_CLASS_INVALID));
35 TEST(WifiSecurityClassTest, WifiSecurityClassToSyncSecurityClass) {
36 EXPECT_EQ(sync_pb::WifiCredentialSpecifics::SECURITY_CLASS_NONE,
37 WifiSecurityClassToSyncSecurityClass(SECURITY_CLASS_NONE));
38 EXPECT_EQ(sync_pb::WifiCredentialSpecifics::SECURITY_CLASS_WEP,
39 WifiSecurityClassToSyncSecurityClass(SECURITY_CLASS_WEP));
40 EXPECT_EQ(sync_pb::WifiCredentialSpecifics::SECURITY_CLASS_PSK,
41 WifiSecurityClassToSyncSecurityClass(SECURITY_CLASS_PSK));
42 EXPECT_EQ(sync_pb::WifiCredentialSpecifics::SECURITY_CLASS_INVALID,
43 WifiSecurityClassToSyncSecurityClass(SECURITY_CLASS_802_1X));
44 EXPECT_EQ(sync_pb::WifiCredentialSpecifics::SECURITY_CLASS_INVALID,
45 WifiSecurityClassToSyncSecurityClass(SECURITY_CLASS_INVALID));
48 TEST(WifiSecurityClassTest, WifiSecurityClassToOncSecurityString) {
49 std::string security_string;
51 EXPECT_TRUE(WifiSecurityClassToOncSecurityString(
52 SECURITY_CLASS_NONE, &security_string));
53 EXPECT_EQ(onc::wifi::kSecurityNone, security_string);
55 EXPECT_TRUE(WifiSecurityClassToOncSecurityString(
56 SECURITY_CLASS_WEP, &security_string));
57 EXPECT_EQ(onc::wifi::kWEP_PSK, security_string);
59 EXPECT_TRUE(WifiSecurityClassToOncSecurityString(
60 SECURITY_CLASS_PSK, &security_string));
61 EXPECT_EQ(onc::wifi::kWPA_PSK, security_string);
63 EXPECT_TRUE(WifiSecurityClassToOncSecurityString(SECURITY_CLASS_802_1X,
64 &security_string));
65 EXPECT_EQ(onc::wifi::kWPA_EAP, security_string);
67 EXPECT_FALSE(WifiSecurityClassToOncSecurityString(
68 SECURITY_CLASS_INVALID, &security_string));
71 } // namespace wifi_sync