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

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

Issue 1549113002: Switch to standard integer types in content/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <list> 8 #include <list>
6 9
7 #include "base/bind.h" 10 #include "base/bind.h"
8 #include "base/location.h" 11 #include "base/location.h"
9 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
10 #include "base/run_loop.h" 13 #include "base/run_loop.h"
11 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
12 #include "base/strings/utf_string_conversions.h" 15 #include "base/strings/utf_string_conversions.h"
13 #include "base/thread_task_runner_handle.h" 16 #include "base/thread_task_runner_handle.h"
14 #include "content/browser/speech/google_streaming_remote_engine.h" 17 #include "content/browser/speech/google_streaming_remote_engine.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 mock_streaming_server_.reset(); 133 mock_streaming_server_.reset();
131 } 134 }
132 135
133 private: 136 private:
134 static void FeedSingleBufferToAudioController( 137 static void FeedSingleBufferToAudioController(
135 scoped_refptr<media::TestAudioInputController> controller, 138 scoped_refptr<media::TestAudioInputController> controller,
136 size_t buffer_size, 139 size_t buffer_size,
137 bool fill_with_noise) { 140 bool fill_with_noise) {
138 DCHECK(controller.get()); 141 DCHECK(controller.get());
139 const media::AudioParameters& audio_params = controller->audio_parameters(); 142 const media::AudioParameters& audio_params = controller->audio_parameters();
140 scoped_ptr<uint8[]> audio_buffer(new uint8[buffer_size]); 143 scoped_ptr<uint8_t[]> audio_buffer(new uint8_t[buffer_size]);
141 if (fill_with_noise) { 144 if (fill_with_noise) {
142 for (size_t i = 0; i < buffer_size; ++i) 145 for (size_t i = 0; i < buffer_size; ++i)
143 audio_buffer[i] = static_cast<uint8>(127 * sin(i * 3.14F / 146 audio_buffer[i] =
144 (16 * buffer_size))); 147 static_cast<uint8_t>(127 * sin(i * 3.14F / (16 * buffer_size)));
145 } else { 148 } else {
146 memset(audio_buffer.get(), 0, buffer_size); 149 memset(audio_buffer.get(), 0, buffer_size);
147 } 150 }
148 151
149 scoped_ptr<media::AudioBus> audio_bus = 152 scoped_ptr<media::AudioBus> audio_bus =
150 media::AudioBus::Create(audio_params); 153 media::AudioBus::Create(audio_params);
151 audio_bus->FromInterleaved(&audio_buffer.get()[0], 154 audio_bus->FromInterleaved(&audio_buffer.get()[0],
152 audio_bus->frames(), 155 audio_bus->frames(),
153 audio_params.bits_per_sample() / 8); 156 audio_params.bits_per_sample() / 8);
154 controller->event_handler()->OnData(controller.get(), audio_bus.get()); 157 controller->event_handler()->OnData(controller.get(), audio_bus.get());
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 205
203 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, OneShotRecognition) { 206 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, OneShotRecognition) {
204 NavigateToURLBlockUntilNavigationsComplete( 207 NavigateToURLBlockUntilNavigationsComplete(
205 shell(), GetTestUrlFromFragment("oneshot"), 2); 208 shell(), GetTestUrlFromFragment("oneshot"), 2);
206 209
207 EXPECT_EQ(kClientDisconnected, streaming_server_state()); 210 EXPECT_EQ(kClientDisconnected, streaming_server_state());
208 EXPECT_EQ("goodresult1", GetPageFragment()); 211 EXPECT_EQ("goodresult1", GetPageFragment());
209 } 212 }
210 213
211 } // namespace content 214 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698