| 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 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1814 EXPECT_EQ("polyglottal", value); | 1815 EXPECT_EQ("polyglottal", value); |
| 1815 found++; | 1816 found++; |
| 1816 } else { | 1817 } else { |
| 1817 FAIL(); | 1818 FAIL(); |
| 1818 } | 1819 } |
| 1819 } | 1820 } |
| 1820 EXPECT_EQ(2u, found); | 1821 EXPECT_EQ(2u, found); |
| 1821 } | 1822 } |
| 1822 | 1823 |
| 1823 } // namespace content | 1824 } // namespace content |
| OLD | NEW |