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 // StringValue that skips the DCHECK in the constructor for valid UTF8. | 18 // StringValue that skips the DCHECK in the constructor for valid UTF8. |
19 class TestStringValue : public base::Value { | 19 class TestStringValue : public base::Value { |
20 public: | 20 public: |
21 explicit TestStringValue(const std::string& in_value) | 21 explicit TestStringValue(const std::string& in_value) |
22 : base::Value(TYPE_STRING), | 22 : base::Value(TYPE_STRING), |
23 value_(in_value) { | 23 value_(in_value) { |
24 } | 24 } |
25 | 25 |
26 virtual ~TestStringValue() { | 26 virtual ~TestStringValue() { |
27 } | 27 } |
28 | 28 |
29 // Overridden from Value: | 29 // Overridden from Value: |
30 virtual bool GetAsString(std::string* out_value) const OVERRIDE { | 30 virtual bool GetAsString(std::string* out_value) const override { |
31 if (out_value) | 31 if (out_value) |
32 *out_value = value_; | 32 *out_value = value_; |
33 return true; | 33 return true; |
34 } | 34 } |
35 | 35 |
36 virtual TestStringValue* DeepCopy() const OVERRIDE { | 36 virtual TestStringValue* DeepCopy() const override { |
37 return new TestStringValue(value_); | 37 return new TestStringValue(value_); |
38 } | 38 } |
39 | 39 |
40 virtual bool Equals(const base::Value* other) const OVERRIDE { | 40 virtual bool Equals(const base::Value* other) const override { |
41 if (other->GetType() != GetType()) | 41 if (other->GetType() != GetType()) |
42 return false; | 42 return false; |
43 std::string lhs, rhs; | 43 std::string lhs, rhs; |
44 return GetAsString(&lhs) && other->GetAsString(&rhs) && lhs == rhs; | 44 return GetAsString(&lhs) && other->GetAsString(&rhs) && lhs == rhs; |
45 } | 45 } |
46 | 46 |
47 private: | 47 private: |
48 std::string value_; | 48 std::string value_; |
49 }; | 49 }; |
50 | 50 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 | 137 |
138 std::string wifi_hex_result = "This is HEX SSID!"; | 138 std::string wifi_hex_result = "This is HEX SSID!"; |
139 std::string wifi_hex = | 139 std::string wifi_hex = |
140 base::HexEncode(wifi_hex_result.c_str(), wifi_hex_result.length()); | 140 base::HexEncode(wifi_hex_result.c_str(), wifi_hex_result.length()); |
141 EXPECT_FALSE(SetStringProperty(shill::kWifiHexSsid, wifi_hex)); | 141 EXPECT_FALSE(SetStringProperty(shill::kWifiHexSsid, wifi_hex)); |
142 EXPECT_TRUE(SignalInitialPropertiesReceived()); | 142 EXPECT_TRUE(SignalInitialPropertiesReceived()); |
143 EXPECT_EQ(network_state_.name(), wifi_hex_result); | 143 EXPECT_EQ(network_state_.name(), wifi_hex_result); |
144 } | 144 } |
145 | 145 |
146 } // namespace chromeos | 146 } // namespace chromeos |
OLD | NEW |