Chromium Code Reviews| 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 "net/base/net_util.h" | 5 #include "net/base/net_util.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <ostream> | 9 #include <ostream> |
| 10 | 10 |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 783 EXPECT_NE(WIFI_PHY_LAYER_PROTOCOL_NONE, GetWifiPHYLayerProtocol()); | 783 EXPECT_NE(WIFI_PHY_LAYER_PROTOCOL_NONE, GetWifiPHYLayerProtocol()); |
| 784 } | 784 } |
| 785 #elif !defined(OS_ANDROID) | 785 #elif !defined(OS_ANDROID) |
| 786 char name[IF_NAMESIZE]; | 786 char name[IF_NAMESIZE]; |
| 787 EXPECT_TRUE(if_indextoname(it->interface_index, name)); | 787 EXPECT_TRUE(if_indextoname(it->interface_index, name)); |
| 788 EXPECT_STREQ(it->name.c_str(), name); | 788 EXPECT_STREQ(it->name.c_str(), name); |
| 789 #endif | 789 #endif |
| 790 } | 790 } |
| 791 } | 791 } |
| 792 | 792 |
| 793 // Test SetWifiOptions(). | |
| 794 TEST(NetUtilTest, SetWifiOptionsTest) { | |
| 795 SetWifiOptions(0); | |
| 796 SetWifiOptions(WIFI_OPTIONS_DISABLE_SCAN); | |
| 797 SetWifiOptions(WIFI_OPTIONS_MEDIA_STREAMING_MODE); | |
| 798 SetWifiOptions(WIFI_OPTIONS_DISABLE_SCAN | | |
| 799 WIFI_OPTIONS_MEDIA_STREAMING_MODE); | |
|
pauljensen
2014/09/18 14:16:50
I assume you can verify that these functions are t
hubbe
2014/09/18 18:21:05
It's possible, but is it worth it?
I'll have to e
pauljensen
2014/09/18 18:40:20
I believe it is worth adding a test when adding a
hubbe
2014/09/18 23:42:51
Done.
| |
| 800 } | |
| 801 | |
| 802 | |
| 793 struct NonUniqueNameTestData { | 803 struct NonUniqueNameTestData { |
| 794 bool is_unique; | 804 bool is_unique; |
| 795 const char* hostname; | 805 const char* hostname; |
| 796 }; | 806 }; |
| 797 | 807 |
| 798 // Google Test pretty-printer. | 808 // Google Test pretty-printer. |
| 799 void PrintTo(const NonUniqueNameTestData& data, std::ostream* os) { | 809 void PrintTo(const NonUniqueNameTestData& data, std::ostream* os) { |
| 800 ASSERT_TRUE(data.hostname); | 810 ASSERT_TRUE(data.hostname); |
| 801 *os << " hostname: " << testing::PrintToString(data.hostname) | 811 *os << " hostname: " << testing::PrintToString(data.hostname) |
| 802 << "; is_unique: " << testing::PrintToString(data.is_unique); | 812 << "; is_unique: " << testing::PrintToString(data.is_unique); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 864 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) { | 874 TEST_P(NetUtilNonUniqueNameTest, IsHostnameNonUnique) { |
| 865 const NonUniqueNameTestData& test_data = GetParam(); | 875 const NonUniqueNameTestData& test_data = GetParam(); |
| 866 | 876 |
| 867 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname)); | 877 EXPECT_EQ(test_data.is_unique, IsUnique(test_data.hostname)); |
| 868 } | 878 } |
| 869 | 879 |
| 870 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest, | 880 INSTANTIATE_TEST_CASE_P(, NetUtilNonUniqueNameTest, |
| 871 testing::ValuesIn(kNonUniqueNameTestData)); | 881 testing::ValuesIn(kNonUniqueNameTestData)); |
| 872 | 882 |
| 873 } // namespace net | 883 } // namespace net |
| OLD | NEW |