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 <queue> | 5 #include <queue> |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "content/browser/speech/audio_buffer.h" | 10 #include "content/browser/speech/audio_buffer.h" |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 // de-registered from the TestURLFetcherFactory on destruction. | 373 // de-registered from the TestURLFetcherFactory on destruction. |
374 } | 374 } |
375 | 375 |
376 void GoogleStreamingRemoteEngineTest::InjectDummyAudioChunk() { | 376 void GoogleStreamingRemoteEngineTest::InjectDummyAudioChunk() { |
377 unsigned char dummy_audio_buffer_data[2] = {'\0', '\0'}; | 377 unsigned char dummy_audio_buffer_data[2] = {'\0', '\0'}; |
378 scoped_refptr<AudioChunk> dummy_audio_chunk( | 378 scoped_refptr<AudioChunk> dummy_audio_chunk( |
379 new AudioChunk(&dummy_audio_buffer_data[0], | 379 new AudioChunk(&dummy_audio_buffer_data[0], |
380 sizeof(dummy_audio_buffer_data), | 380 sizeof(dummy_audio_buffer_data), |
381 2 /* bytes per sample */)); | 381 2 /* bytes per sample */)); |
382 DCHECK(engine_under_test_.get()); | 382 DCHECK(engine_under_test_.get()); |
383 engine_under_test_->TakeAudioChunk(*dummy_audio_chunk); | 383 engine_under_test_->TakeAudioChunk(*dummy_audio_chunk.get()); |
384 } | 384 } |
385 | 385 |
386 size_t GoogleStreamingRemoteEngineTest::UpstreamChunksUploadedFromLastCall() { | 386 size_t GoogleStreamingRemoteEngineTest::UpstreamChunksUploadedFromLastCall() { |
387 TestURLFetcher* upstream_fetcher = GetUpstreamFetcher(); | 387 TestURLFetcher* upstream_fetcher = GetUpstreamFetcher(); |
388 DCHECK(upstream_fetcher); | 388 DCHECK(upstream_fetcher); |
389 const size_t number_of_chunks = upstream_fetcher->upload_chunks().size(); | 389 const size_t number_of_chunks = upstream_fetcher->upload_chunks().size(); |
390 DCHECK_GE(number_of_chunks, last_number_of_upstream_chunks_seen_); | 390 DCHECK_GE(number_of_chunks, last_number_of_upstream_chunks_seen_); |
391 const size_t new_chunks = number_of_chunks - | 391 const size_t new_chunks = number_of_chunks - |
392 last_number_of_upstream_chunks_seen_; | 392 last_number_of_upstream_chunks_seen_; |
393 last_number_of_upstream_chunks_seen_ = number_of_chunks; | 393 last_number_of_upstream_chunks_seen_ = number_of_chunks; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 std::string GoogleStreamingRemoteEngineTest::ToBigEndian32(uint32 value) { | 494 std::string GoogleStreamingRemoteEngineTest::ToBigEndian32(uint32 value) { |
495 char raw_data[4]; | 495 char raw_data[4]; |
496 raw_data[0] = static_cast<uint8>((value >> 24) & 0xFF); | 496 raw_data[0] = static_cast<uint8>((value >> 24) & 0xFF); |
497 raw_data[1] = static_cast<uint8>((value >> 16) & 0xFF); | 497 raw_data[1] = static_cast<uint8>((value >> 16) & 0xFF); |
498 raw_data[2] = static_cast<uint8>((value >> 8) & 0xFF); | 498 raw_data[2] = static_cast<uint8>((value >> 8) & 0xFF); |
499 raw_data[3] = static_cast<uint8>(value & 0xFF); | 499 raw_data[3] = static_cast<uint8>(value & 0xFF); |
500 return std::string(raw_data, sizeof(raw_data)); | 500 return std::string(raw_data, sizeof(raw_data)); |
501 } | 501 } |
502 | 502 |
503 } // namespace content | 503 } // namespace content |
OLD | NEW |