| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chromeos/network/network_state.h" | 5 #include "chromeos/network/network_state.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 #include "third_party/cros_system_api/dbus/service_constants.h" | 12 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 13 | 13 |
| 14 namespace chromeos { | 14 namespace chromeos { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 class TestStringValue : public base::Value { | 18 class TestStringValue : public base::Value { |
| 19 public: | 19 public: |
| 20 TestStringValue(const std::string& in_value) | 20 explicit TestStringValue(const std::string& in_value) |
| 21 : base::Value(TYPE_STRING), | 21 : base::Value(TYPE_STRING), |
| 22 value_(in_value) { | 22 value_(in_value) { |
| 23 } | 23 } |
| 24 | 24 |
| 25 ~TestStringValue() { | 25 virtual ~TestStringValue() { |
| 26 } | 26 } |
| 27 | 27 |
| 28 // Overridden from Value: | 28 // Overridden from Value: |
| 29 virtual bool GetAsString(std::string* out_value) const OVERRIDE { | 29 virtual bool GetAsString(std::string* out_value) const OVERRIDE { |
| 30 if (out_value) | 30 if (out_value) |
| 31 *out_value = value_; | 31 *out_value = value_; |
| 32 return true; | 32 return true; |
| 33 } | 33 } |
| 34 | 34 |
| 35 virtual TestStringValue* DeepCopy() const OVERRIDE { | 35 virtual TestStringValue* DeepCopy() const OVERRIDE { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 | 112 |
| 113 // Hex SSID | 113 // Hex SSID |
| 114 TEST_F(NetworkStateTest, SsidHex) { | 114 TEST_F(NetworkStateTest, SsidHex) { |
| 115 std::string wifi_hex = "5468697320697320484558205353494421"; | 115 std::string wifi_hex = "5468697320697320484558205353494421"; |
| 116 std::string wifi_hex_result = "This is HEX SSID!"; | 116 std::string wifi_hex_result = "This is HEX SSID!"; |
| 117 SetStringProperty(flimflam::kWifiHexSsid, wifi_hex); | 117 SetStringProperty(flimflam::kWifiHexSsid, wifi_hex); |
| 118 EXPECT_EQ(network_state_.name(), wifi_hex_result); | 118 EXPECT_EQ(network_state_.name(), wifi_hex_result); |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace chromeos | 121 } // namespace chromeos |
| OLD | NEW |