Chromium Code Reviews| Index: remoting/test/chromoting_host_info.cc |
| diff --git a/remoting/test/chromoting_host_info.cc b/remoting/test/chromoting_host_info.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..647daf9ffd8585757e097511dd841b3f173c59ea |
| --- /dev/null |
| +++ b/remoting/test/chromoting_host_info.cc |
| @@ -0,0 +1,45 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "remoting/test/chromoting_host_info.h" |
| + |
| +#include "base/logging.h" |
| + |
| +namespace remoting { |
| +namespace test { |
| + |
| +ChromotingHostInfo::ChromotingHostInfo(const base::DictionaryValue& item) { |
| + const base::ListValue* listValue = nullptr; |
| + item.GetList("data.tokenUrlPatterns", &listValue); |
| + |
| + // Add TokenUrlPatterns to ChromotingHostInfo |
| + if(listValue != nullptr) { |
|
joedow
2015/07/01 03:39:33
add space between if and open paren
tonychun
2015/07/06 20:11:50
Done.
|
| + int size = listValue->GetSize(); |
| + if (size > 0) { |
| + std::string tokenUrlPattern; |
| + for(int i = 0; i < size; ++i) { |
|
joedow
2015/07/01 03:39:33
add space between for and open paren (please run c
tonychun
2015/07/06 20:11:50
Done.
|
| + listValue->GetString(i,&tokenUrlPattern); |
|
joedow
2015/07/01 03:39:33
add space between comma and ampersand
tonychun
2015/07/06 20:11:50
Done.
|
| + if(!tokenUrlPattern.empty()) { |
|
joedow
2015/07/01 03:39:33
Add space between if and open paren (please run cp
tonychun
2015/07/06 20:11:50
Done.
|
| + tokenUrlPatterns.push_back(tokenUrlPattern); |
| + } |
| + } |
| + } |
| + } |
| + |
| + item.GetString("hostId", &id); |
|
joedow
2015/07/01 03:39:33
tokenUrlPatterns is under 'data' per the code on l
tonychun
2015/07/06 20:11:50
This is a bug. My unit test would have flagged thi
|
| + item.GetString("jabberId", &jid); |
| + item.GetString("hostName", &name); |
| + item.GetString("hostOfflineReason", &offline_reason); |
| + item.GetString("publicKey", &public_key); |
| + |
| + std::string status; |
| + item.GetString("status", &status); |
| + is_online = (status == "ONLINE") ? true : false; |
|
joedow
2015/07/01 03:39:33
Are there other statuses? I'm thinking that an en
joedow
2015/07/01 03:39:33
"ONLINE" should be a constant in a namespace at th
tonychun
2015/07/06 20:11:50
Done.
|
| +} |
| + |
| +ChromotingHostInfo::~ChromotingHostInfo() { |
| +} |
| + |
| +} // namespace test |
| +} // namespace remoting |