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

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

Issue 1891543002: Devirtualize SpeechRecognitionEngine (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@kill_one_shot_engine
Patch Set: drop an include Created 4 years, 8 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> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <list> 9 #include <list>
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/thread_task_runner_handle.h" 17 #include "base/thread_task_runner_handle.h"
18 #include "content/browser/speech/google_streaming_remote_engine.h" 18 #include "content/browser/speech/speech_recognition_engine.h"
19 #include "content/browser/speech/speech_recognition_manager_impl.h" 19 #include "content/browser/speech/speech_recognition_manager_impl.h"
20 #include "content/browser/speech/speech_recognizer_impl.h" 20 #include "content/browser/speech/speech_recognizer_impl.h"
21 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
22 #include "content/public/browser/notification_types.h" 22 #include "content/public/browser/notification_types.h"
23 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
24 #include "content/public/test/browser_test_utils.h" 24 #include "content/public/test/browser_test_utils.h"
25 #include "content/public/test/content_browser_test.h" 25 #include "content/public/test/content_browser_test.h"
26 #include "content/public/test/content_browser_test_utils.h" 26 #include "content/public/test/content_browser_test_utils.h"
27 #include "content/public/test/test_utils.h" 27 #include "content/public/test/test_utils.h"
28 #include "content/shell/browser/shell.h" 28 #include "content/shell/browser/shell.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 73
74 // media::TestAudioInputControllerDelegate methods. 74 // media::TestAudioInputControllerDelegate methods.
75 void TestAudioControllerOpened( 75 void TestAudioControllerOpened(
76 media::TestAudioInputController* controller) override { 76 media::TestAudioInputController* controller) override {
77 ASSERT_EQ(kIdle, streaming_server_state_); 77 ASSERT_EQ(kIdle, streaming_server_state_);
78 streaming_server_state_ = kTestAudioControllerOpened; 78 streaming_server_state_ = kTestAudioControllerOpened;
79 const int capture_packet_interval_ms = 79 const int capture_packet_interval_ms =
80 (1000 * controller->audio_parameters().frames_per_buffer()) / 80 (1000 * controller->audio_parameters().frames_per_buffer()) /
81 controller->audio_parameters().sample_rate(); 81 controller->audio_parameters().sample_rate();
82 ASSERT_EQ(GoogleStreamingRemoteEngine::kAudioPacketIntervalMs, 82 ASSERT_EQ(SpeechRecognitionEngine::kAudioPacketIntervalMs,
83 capture_packet_interval_ms); 83 capture_packet_interval_ms);
84 FeedAudioController(500 /* ms */, /*noise=*/ false); 84 FeedAudioController(500 /* ms */, /*noise=*/ false);
85 FeedAudioController(1000 /* ms */, /*noise=*/ true); 85 FeedAudioController(1000 /* ms */, /*noise=*/ true);
86 FeedAudioController(1000 /* ms */, /*noise=*/ false); 86 FeedAudioController(1000 /* ms */, /*noise=*/ false);
87 } 87 }
88 88
89 void TestAudioControllerClosed( 89 void TestAudioControllerClosed(
90 media::TestAudioInputController* controller) override { 90 media::TestAudioInputController* controller) override {
91 ASSERT_EQ(kClientAudioUpload, streaming_server_state_); 91 ASSERT_EQ(kClientAudioUpload, streaming_server_state_);
92 streaming_server_state_ = kTestAudioControllerClosed; 92 streaming_server_state_ = kTestAudioControllerClosed;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 206
207 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, OneShotRecognition) { 207 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, OneShotRecognition) {
208 NavigateToURLBlockUntilNavigationsComplete( 208 NavigateToURLBlockUntilNavigationsComplete(
209 shell(), GetTestUrlFromFragment("oneshot"), 2); 209 shell(), GetTestUrlFromFragment("oneshot"), 2);
210 210
211 EXPECT_EQ(kClientDisconnected, streaming_server_state()); 211 EXPECT_EQ(kClientDisconnected, streaming_server_state());
212 EXPECT_EQ("goodresult1", GetPageFragment()); 212 EXPECT_EQ("goodresult1", GetPageFragment());
213 } 213 }
214 214
215 } // namespace content 215 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698