OLD | NEW |
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/remote_host_info_fetcher.h" | 5 #include "remoting/test/remote_host_info_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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 return; | 80 return; |
81 } | 81 } |
82 | 82 |
83 std::string response_string; | 83 std::string response_string; |
84 if (!request_->GetResponseAsString(&response_string)) { | 84 if (!request_->GetResponseAsString(&response_string)) { |
85 LOG(ERROR) << "Failed to retrieve RemoteHostInfo response data"; | 85 LOG(ERROR) << "Failed to retrieve RemoteHostInfo response data"; |
86 base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info); | 86 base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info); |
87 return; | 87 return; |
88 } | 88 } |
89 | 89 |
90 scoped_ptr<base::Value> response_value( | 90 std::unique_ptr<base::Value> response_value( |
91 base::JSONReader::Read(response_string)); | 91 base::JSONReader::Read(response_string)); |
92 if (!response_value || | 92 if (!response_value || |
93 !response_value->IsType(base::Value::TYPE_DICTIONARY)) { | 93 !response_value->IsType(base::Value::TYPE_DICTIONARY)) { |
94 LOG(ERROR) << "Failed to parse response string to JSON"; | 94 LOG(ERROR) << "Failed to parse response string to JSON"; |
95 base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info); | 95 base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info); |
96 return; | 96 return; |
97 } | 97 } |
98 | 98 |
99 std::string remote_host_status; | 99 std::string remote_host_status; |
100 const base::DictionaryValue* response; | 100 const base::DictionaryValue* response; |
(...skipping 14 matching lines...) Expand all Loading... |
115 response->GetString("authorizationCode", | 115 response->GetString("authorizationCode", |
116 &remote_host_info.authorization_code); | 116 &remote_host_info.authorization_code); |
117 response->GetString("sharedSecret", &remote_host_info.shared_secret); | 117 response->GetString("sharedSecret", &remote_host_info.shared_secret); |
118 } | 118 } |
119 | 119 |
120 base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info); | 120 base::ResetAndReturn(&remote_host_info_callback_).Run(remote_host_info); |
121 } | 121 } |
122 | 122 |
123 } // namespace test | 123 } // namespace test |
124 } // namespace remoting | 124 } // namespace remoting |
OLD | NEW |