OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
| 6 |
6 #include <utility> | 7 #include <utility> |
7 | 8 |
8 #include "base/base64.h" | 9 #include "base/base64.h" |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
11 #include "base/command_line.h" | 12 #include "base/command_line.h" |
12 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
13 #include "base/json/json_writer.h" | 14 #include "base/json/json_writer.h" |
14 #include "base/logging.h" | 15 #include "base/logging.h" |
15 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 } | 174 } |
174 | 175 |
175 void SendCommand(const std::string& method, | 176 void SendCommand(const std::string& method, |
176 std::unique_ptr<base::DictionaryValue> params, | 177 std::unique_ptr<base::DictionaryValue> params, |
177 bool wait) { | 178 bool wait) { |
178 in_dispatch_ = true; | 179 in_dispatch_ = true; |
179 base::DictionaryValue command; | 180 base::DictionaryValue command; |
180 command.SetInteger(kIdParam, ++last_sent_id_); | 181 command.SetInteger(kIdParam, ++last_sent_id_); |
181 command.SetString(kMethodParam, method); | 182 command.SetString(kMethodParam, method); |
182 if (params) | 183 if (params) |
183 command.Set(kParamsParam, params.release()); | 184 command.Set(kParamsParam, std::move(params)); |
184 | 185 |
185 std::string json_command; | 186 std::string json_command; |
186 base::JSONWriter::Write(command, &json_command); | 187 base::JSONWriter::Write(command, &json_command); |
187 agent_host_->DispatchProtocolMessage(this, json_command); | 188 agent_host_->DispatchProtocolMessage(this, json_command); |
188 // Some messages are dispatched synchronously. | 189 // Some messages are dispatched synchronously. |
189 // Only run loop if we are not finished yet. | 190 // Only run loop if we are not finished yet. |
190 if (in_dispatch_ && wait) | 191 if (in_dispatch_ && wait) |
191 WaitForResponse(); | 192 WaitForResponse(); |
192 in_dispatch_ = false; | 193 in_dispatch_ = false; |
193 } | 194 } |
(...skipping 1643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1837 EXPECT_EQ("polyglottal", value); | 1838 EXPECT_EQ("polyglottal", value); |
1838 found++; | 1839 found++; |
1839 } else { | 1840 } else { |
1840 FAIL(); | 1841 FAIL(); |
1841 } | 1842 } |
1842 } | 1843 } |
1843 EXPECT_EQ(2u, found); | 1844 EXPECT_EQ(2u, found); |
1844 } | 1845 } |
1845 | 1846 |
1846 } // namespace content | 1847 } // namespace content |
OLD | NEW |