| OLD | NEW |
| 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 "net/log/test_net_log_entry.h" | 5 #include "net/log/test_net_log_entry.h" |
| 6 | 6 |
| 7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 | 10 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 return params->GetString(name, value); | 47 return params->GetString(name, value); |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool TestNetLogEntry::GetIntegerValue(const std::string& name, | 50 bool TestNetLogEntry::GetIntegerValue(const std::string& name, |
| 51 int* value) const { | 51 int* value) const { |
| 52 if (!params) | 52 if (!params) |
| 53 return false; | 53 return false; |
| 54 return params->GetInteger(name, value); | 54 return params->GetInteger(name, value); |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool TestNetLogEntry::GetBooleanValue(const std::string& name, |
| 58 bool* value) const { |
| 59 if (!params) |
| 60 return false; |
| 61 return params->GetBoolean(name, value); |
| 62 } |
| 63 |
| 57 bool TestNetLogEntry::GetListValue(const std::string& name, | 64 bool TestNetLogEntry::GetListValue(const std::string& name, |
| 58 base::ListValue** value) const { | 65 base::ListValue** value) const { |
| 59 if (!params) | 66 if (!params) |
| 60 return false; | 67 return false; |
| 61 return params->GetList(name, value); | 68 return params->GetList(name, value); |
| 62 } | 69 } |
| 63 | 70 |
| 64 bool TestNetLogEntry::GetNetErrorCode(int* value) const { | 71 bool TestNetLogEntry::GetNetErrorCode(int* value) const { |
| 65 return GetIntegerValue("net_error", value); | 72 return GetIntegerValue("net_error", value); |
| 66 } | 73 } |
| 67 | 74 |
| 68 std::string TestNetLogEntry::GetParamsJson() const { | 75 std::string TestNetLogEntry::GetParamsJson() const { |
| 69 if (!params) | 76 if (!params) |
| 70 return std::string(); | 77 return std::string(); |
| 71 std::string json; | 78 std::string json; |
| 72 base::JSONWriter::Write(params.get(), &json); | 79 base::JSONWriter::Write(params.get(), &json); |
| 73 return json; | 80 return json; |
| 74 } | 81 } |
| 75 | 82 |
| 76 } // namespace net | 83 } // namespace net |
| OLD | NEW |