Compute if a layer is clipped outside CalcDrawProps
[chromium-blink-merge.git] / remoting / test / host_info.cc
blob341829f662e5f40815c61b2b29e817de77cc8172
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
3 // found in the LICENSE file.
5 #include "remoting/test/host_info.h"
7 #include "base/logging.h"
9 namespace remoting {
10 namespace test {
12 HostInfo::HostInfo() {
15 HostInfo::~HostInfo() {
18 bool HostInfo::ParseHostInfo(const base::DictionaryValue& host_info) {
19 const base::ListValue* list_value = nullptr;
21 // Add TokenUrlPatterns to HostInfo.
22 if (host_info.GetList("tokenUrlPatterns", &list_value)) {
23 if (!list_value->empty()) {
24 for (base::Value* item : *list_value) {
25 std::string token_url_pattern;
26 if (!item->GetAsString(&token_url_pattern)) {
27 return false;
29 token_url_patterns.push_back(token_url_pattern);
34 std::string response_status;
35 host_info.GetString("status", &response_status);
36 if (response_status == "ONLINE") {
37 status = kHostStatusOnline;
38 } else if (response_status == "OFFLINE") {
39 status = kHostStatusOffline;
40 } else {
41 LOG(ERROR) << "Response Status is " << response_status;
42 return false;
45 if (!host_info.GetString("hostId", &host_id)) {
46 LOG(ERROR) << "hostId was not found in host_info";
47 return false;
50 if (!host_info.GetString("hostName", &host_name)) {
51 LOG(ERROR) << "hostName was not found in host_info";
52 return false;
55 if (!host_info.GetString("publicKey", &public_key)) {
56 LOG(ERROR) << "publicKey was not found for " << host_name;
57 return false;
60 // If the host entry was created but the host was never online, then the jid
61 // is never set.
62 if (!host_info.GetString("jabberId", &host_jid) &&
63 status == kHostStatusOnline) {
64 LOG(ERROR) << host_name << " is online but is missing a jabberId";
65 return false;
68 host_info.GetString("hostOfflineReason", &offline_reason);
70 return true;
73 } // namespace test
74 } // namespace remoting