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

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

Issue 14335017: content: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 size_t UpstreamChunksUploadedFromLastCall(); 72 size_t UpstreamChunksUploadedFromLastCall();
73 void ProvideMockProtoResultDownstream( 73 void ProvideMockProtoResultDownstream(
74 const proto::SpeechRecognitionEvent& result); 74 const proto::SpeechRecognitionEvent& result);
75 void ProvideMockResultDownstream(const SpeechRecognitionResult& result); 75 void ProvideMockResultDownstream(const SpeechRecognitionResult& result);
76 void ExpectResultsReceived(const SpeechRecognitionResults& result); 76 void ExpectResultsReceived(const SpeechRecognitionResults& result);
77 void CloseMockDownstream(DownstreamError error); 77 void CloseMockDownstream(DownstreamError error);
78 78
79 scoped_ptr<GoogleStreamingRemoteEngine> engine_under_test_; 79 scoped_ptr<GoogleStreamingRemoteEngine> engine_under_test_;
80 TestURLFetcherFactory url_fetcher_factory_; 80 TestURLFetcherFactory url_fetcher_factory_;
81 size_t last_number_of_upstream_chunks_seen_; 81 size_t last_number_of_upstream_chunks_seen_;
82 MessageLoop message_loop_; 82 base::MessageLoop message_loop_;
83 std::string response_buffer_; 83 std::string response_buffer_;
84 SpeechRecognitionErrorCode error_; 84 SpeechRecognitionErrorCode error_;
85 std::queue<SpeechRecognitionResults> results_; 85 std::queue<SpeechRecognitionResults> results_;
86 }; 86 };
87 87
88 TEST_F(GoogleStreamingRemoteEngineTest, SingleDefinitiveResult) { 88 TEST_F(GoogleStreamingRemoteEngineTest, SingleDefinitiveResult) {
89 StartMockRecognition(); 89 StartMockRecognition();
90 ASSERT_TRUE(GetUpstreamFetcher()); 90 ASSERT_TRUE(GetUpstreamFetcher());
91 ASSERT_EQ(0U, UpstreamChunksUploadedFromLastCall()); 91 ASSERT_EQ(0U, UpstreamChunksUploadedFromLastCall());
92 92
(...skipping 401 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

Powered by Google App Engine
This is Rietveld 408576698