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

Side by Side Diff: components/proximity_auth/remote_status_update_unittest.cc

Issue 1323923002: Remove use of JSONReader::DeprecatedRead from components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Error fix Created 5 years, 3 months 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/proximity_auth/remote_status_update.h" 5 #include "components/proximity_auth/remote_status_update.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace proximity_auth { 11 namespace proximity_auth {
12 namespace { 12 namespace {
13 13
14 // Parses the |json| into a DictionaryValue. 14 // Parses the |json| into a DictionaryValue.
15 scoped_ptr<base::DictionaryValue> ParseJson(const std::string& json) { 15 scoped_ptr<base::DictionaryValue> ParseJson(const std::string& json) {
16 base::DictionaryValue* as_dictionary; 16 base::DictionaryValue* as_dictionary;
17 base::JSONReader::DeprecatedRead(json)->GetAsDictionary(&as_dictionary); 17 base::JSONReader::Read(json).release()->GetAsDictionary(&as_dictionary);
18 return make_scoped_ptr(as_dictionary); 18 return make_scoped_ptr(as_dictionary);
19 } 19 }
20 20
21 } // namespace 21 } // namespace
22 22
23 // Verify that all valid values can be parsed. 23 // Verify that all valid values can be parsed.
24 TEST(ProximityAuthRemoteStatusUpdateTest, Deserialize_ValidStatuses) { 24 TEST(ProximityAuthRemoteStatusUpdateTest, Deserialize_ValidStatuses) {
25 { 25 {
26 const char kValidJson[] = 26 const char kValidJson[] =
27 "{" 27 "{"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 scoped_ptr<RemoteStatusUpdate> parsed_update = 181 scoped_ptr<RemoteStatusUpdate> parsed_update =
182 RemoteStatusUpdate::Deserialize(*ParseJson(kJson)); 182 RemoteStatusUpdate::Deserialize(*ParseJson(kJson));
183 ASSERT_TRUE(parsed_update); 183 ASSERT_TRUE(parsed_update);
184 EXPECT_EQ(USER_PRESENT, parsed_update->user_presence); 184 EXPECT_EQ(USER_PRESENT, parsed_update->user_presence);
185 EXPECT_EQ(SECURE_SCREEN_LOCK_ENABLED, 185 EXPECT_EQ(SECURE_SCREEN_LOCK_ENABLED,
186 parsed_update->secure_screen_lock_state); 186 parsed_update->secure_screen_lock_state);
187 EXPECT_EQ(TRUST_AGENT_ENABLED, parsed_update->trust_agent_state); 187 EXPECT_EQ(TRUST_AGENT_ENABLED, parsed_update->trust_agent_state);
188 } 188 }
189 189
190 } // namespace proximity_auth 190 } // namespace proximity_auth
OLDNEW
« no previous file with comments | « components/policy/tools/generate_policy_source.py ('k') | components/proximity_auth/wire_message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698