Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(286)

Side by Side Diff: content/browser/speech/google_streaming_remote_engine_unittest.cc

Issue 16294003: Update content/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « content/browser/speech/google_streaming_remote_engine.cc ('k') | content/browser/speech/input_tag_speech_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698