Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1420)

Side by Side Diff: chromeos/network/network_state_unittest.cc

Issue 2516363005: Inline StringValue into base::Value (Closed)
Patch Set: GetString by ref and TestStringValue Fix Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/i18n/streaming_utf8_validator.h" 12 #include "base/i18n/streaming_utf8_validator.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
18 #include "third_party/cros_system_api/dbus/service_constants.h" 18 #include "third_party/cros_system_api/dbus/service_constants.h"
19 19
20 namespace chromeos { 20 namespace chromeos {
21 21
22 namespace { 22 namespace {
23 23
24 // StringValue that skips the DCHECK in the constructor for valid UTF8. 24 // StringValue that skips the DCHECK in the constructor for valid UTF8.
25 class TestStringValue : public base::Value { 25 class TestStringValue : public base::Value {
jdoerrie 2016/12/16 09:54:37 This class and these tests will break once we remo
vabr (Chromium) 2016/12/19 13:00:56 Not sure yet. The written contract on the current
26 public: 26 public:
27 explicit TestStringValue(const std::string& in_value) 27 explicit TestStringValue(const std::string& in_value)
28 : base::Value(Type::STRING), value_(in_value) {} 28 : base::Value(Type::STRING), value_(in_value) {}
29 29
30 ~TestStringValue() override {} 30 ~TestStringValue() override {
31 // Ugly hack that prevents ~Value() from trying to destroy string_value_.
32 // TODO(crbug.com/646113): Clean this up when StringValue will be removed.
33 type_ = Type::NONE;
34 }
31 35
32 // Overridden from Value: 36 // Overridden from Value:
33 bool GetAsString(std::string* out_value) const override { 37 bool GetAsString(std::string* out_value) const override {
34 if (out_value) 38 if (out_value)
35 *out_value = value_; 39 *out_value = value_;
36 return true; 40 return true;
37 } 41 }
38 42
39 TestStringValue* DeepCopy() const override { 43 TestStringValue* DeepCopy() const override {
40 return new TestStringValue(value_); 44 return new TestStringValue(value_);
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 provider->SetStringWithoutPathExpansion( 234 provider->SetStringWithoutPathExpansion(
231 shill::kHostProperty, "third-party-vpn-provider-extension-id"); 235 shill::kHostProperty, "third-party-vpn-provider-extension-id");
232 EXPECT_TRUE(SetProperty(shill::kProviderProperty, std::move(provider))); 236 EXPECT_TRUE(SetProperty(shill::kProviderProperty, std::move(provider)));
233 SignalInitialPropertiesReceived(); 237 SignalInitialPropertiesReceived();
234 EXPECT_EQ(network_state_.vpn_provider_type(), shill::kProviderThirdPartyVpn); 238 EXPECT_EQ(network_state_.vpn_provider_type(), shill::kProviderThirdPartyVpn);
235 EXPECT_EQ(network_state_.third_party_vpn_provider_extension_id(), 239 EXPECT_EQ(network_state_.third_party_vpn_provider_extension_id(),
236 "third-party-vpn-provider-extension-id"); 240 "third-party-vpn-provider-extension-id");
237 } 241 }
238 242
239 } // namespace chromeos 243 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698