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

Side by Side Diff: remoting/test/host_list_fetcher.cc

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase 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
« no previous file with comments | « remoting/host/setup/service_client.cc ('k') | remoting/test/remote_host_info_fetcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "remoting/test/host_list_fetcher.h" 5 #include "remoting/test/host_list_fetcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 55
56 std::string response_string; 56 std::string response_string;
57 if (!request_->GetResponseAsString(&response_string)) { 57 if (!request_->GetResponseAsString(&response_string)) {
58 LOG(ERROR) << "Failed to retrieve Hostlist response data"; 58 LOG(ERROR) << "Failed to retrieve Hostlist response data";
59 return false; 59 return false;
60 } 60 }
61 61
62 std::unique_ptr<base::Value> response_value( 62 std::unique_ptr<base::Value> response_value(
63 base::JSONReader::Read(response_string)); 63 base::JSONReader::Read(response_string));
64 if (!response_value || 64 if (!response_value ||
65 !response_value->IsType(base::Value::TYPE_DICTIONARY)) { 65 !response_value->IsType(base::Value::Type::DICTIONARY)) {
66 LOG(ERROR) << "Failed to parse response string to JSON"; 66 LOG(ERROR) << "Failed to parse response string to JSON";
67 return false; 67 return false;
68 } 68 }
69 69
70 const base::DictionaryValue* response; 70 const base::DictionaryValue* response;
71 if (!response_value->GetAsDictionary(&response)) { 71 if (!response_value->GetAsDictionary(&response)) {
72 LOG(ERROR) << "Failed to convert parsed JSON to a dictionary object"; 72 LOG(ERROR) << "Failed to convert parsed JSON to a dictionary object";
73 return false; 73 return false;
74 } 74 }
75 75
(...skipping 29 matching lines...) Expand all
105 std::vector<HostInfo> hostlist; 105 std::vector<HostInfo> hostlist;
106 106
107 if (!ProcessResponse(&hostlist)) { 107 if (!ProcessResponse(&hostlist)) {
108 hostlist.clear(); 108 hostlist.clear();
109 } 109 }
110 base::ResetAndReturn(&hostlist_callback_).Run(hostlist); 110 base::ResetAndReturn(&hostlist_callback_).Run(hostlist);
111 } 111 }
112 112
113 } // namespace test 113 } // namespace test
114 } // namespace remoting 114 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/setup/service_client.cc ('k') | remoting/test/remote_host_info_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698