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

Side by Side Diff: content/browser/speech/endpointer/endpointer_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 "content/browser/speech/audio_buffer.h" 5 #include "content/browser/speech/audio_buffer.h"
6 #include "content/browser/speech/endpointer/endpointer.h" 6 #include "content/browser/speech/endpointer/endpointer.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace { 9 namespace {
10 const int kFrameRate = 50; // 20 ms long frames for AMR encoding. 10 const int kFrameRate = 50; // 20 ms long frames for AMR encoding.
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 class EndpointerFrameProcessor : public FrameProcessor { 116 class EndpointerFrameProcessor : public FrameProcessor {
117 public: 117 public:
118 explicit EndpointerFrameProcessor(Endpointer* endpointer) 118 explicit EndpointerFrameProcessor(Endpointer* endpointer)
119 : endpointer_(endpointer) {} 119 : endpointer_(endpointer) {}
120 120
121 virtual EpStatus ProcessFrame(int64 time, 121 virtual EpStatus ProcessFrame(int64 time,
122 int16* samples, 122 int16* samples,
123 int frame_size) OVERRIDE { 123 int frame_size) OVERRIDE {
124 scoped_refptr<AudioChunk> frame( 124 scoped_refptr<AudioChunk> frame(
125 new AudioChunk(reinterpret_cast<uint8*>(samples), kFrameSize * 2, 2)); 125 new AudioChunk(reinterpret_cast<uint8*>(samples), kFrameSize * 2, 2));
126 endpointer_->ProcessAudio(*frame, NULL); 126 endpointer_->ProcessAudio(*frame.get(), NULL);
127 int64 ep_time; 127 int64 ep_time;
128 return endpointer_->Status(&ep_time); 128 return endpointer_->Status(&ep_time);
129 } 129 }
130 130
131 private: 131 private:
132 Endpointer* endpointer_; 132 Endpointer* endpointer_;
133 }; 133 };
134 134
135 TEST(EndpointerTest, TestEmbeddedEndpointerEvents) { 135 TEST(EndpointerTest, TestEmbeddedEndpointerEvents) {
136 const int kSampleRate = 8000; // 8 k samples per second for AMR encoding. 136 const int kSampleRate = 8000; // 8 k samples per second for AMR encoding.
137 137
138 Endpointer endpointer(kSampleRate); 138 Endpointer endpointer(kSampleRate);
139 const int64 kMillisecondsPerMicrosecond = 1000; 139 const int64 kMillisecondsPerMicrosecond = 1000;
140 const int64 short_timeout = 300 * kMillisecondsPerMicrosecond; 140 const int64 short_timeout = 300 * kMillisecondsPerMicrosecond;
141 endpointer.set_speech_input_possibly_complete_silence_length(short_timeout); 141 endpointer.set_speech_input_possibly_complete_silence_length(short_timeout);
142 const int64 long_timeout = 500 * kMillisecondsPerMicrosecond; 142 const int64 long_timeout = 500 * kMillisecondsPerMicrosecond;
143 endpointer.set_speech_input_complete_silence_length(long_timeout); 143 endpointer.set_speech_input_complete_silence_length(long_timeout);
144 endpointer.StartSession(); 144 endpointer.StartSession();
145 145
146 EndpointerFrameProcessor frame_processor(&endpointer); 146 EndpointerFrameProcessor frame_processor(&endpointer);
147 RunEndpointerEventsTest(&frame_processor); 147 RunEndpointerEventsTest(&frame_processor);
148 148
149 endpointer.EndSession(); 149 endpointer.EndSession();
150 } 150 }
151 151
152 } // namespace content 152 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/site_instance_impl_unittest.cc ('k') | content/browser/speech/google_one_shot_remote_engine.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698