| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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> |
| 6 #include <stdint.h> |
| 7 |
| 5 #include <queue> | 8 #include <queue> |
| 6 | 9 |
| 7 #include "base/big_endian.h" | 10 #include "base/big_endian.h" |
| 8 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
| 10 #include "base/numerics/safe_conversions.h" | 13 #include "base/numerics/safe_conversions.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 12 #include "base/sys_byteorder.h" | 15 #include "base/sys_byteorder.h" |
| 13 #include "content/browser/speech/audio_buffer.h" | 16 #include "content/browser/speech/audio_buffer.h" |
| 14 #include "content/browser/speech/google_streaming_remote_engine.h" | 17 #include "content/browser/speech/google_streaming_remote_engine.h" |
| (...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 EXPECT_EQ(type, value); | 589 EXPECT_EQ(type, value); |
| 587 } | 590 } |
| 588 | 591 |
| 589 std::string GoogleStreamingRemoteEngineTest::SerializeProtobufResponse( | 592 std::string GoogleStreamingRemoteEngineTest::SerializeProtobufResponse( |
| 590 const proto::SpeechRecognitionEvent& msg) { | 593 const proto::SpeechRecognitionEvent& msg) { |
| 591 std::string msg_string; | 594 std::string msg_string; |
| 592 msg.SerializeToString(&msg_string); | 595 msg.SerializeToString(&msg_string); |
| 593 | 596 |
| 594 // Prepend 4 byte prefix length indication to the protobuf message as | 597 // Prepend 4 byte prefix length indication to the protobuf message as |
| 595 // envisaged by the google streaming recognition webservice protocol. | 598 // envisaged by the google streaming recognition webservice protocol. |
| 596 uint32 prefix = HostToNet32(checked_cast<uint32>(msg_string.size())); | 599 uint32_t prefix = HostToNet32(checked_cast<uint32_t>(msg_string.size())); |
| 597 msg_string.insert(0, reinterpret_cast<char*>(&prefix), sizeof(prefix)); | 600 msg_string.insert(0, reinterpret_cast<char*>(&prefix), sizeof(prefix)); |
| 598 | 601 |
| 599 return msg_string; | 602 return msg_string; |
| 600 } | 603 } |
| 601 | 604 |
| 602 } // namespace content | 605 } // namespace content |
| OLD | NEW |