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

Side by Side Diff: chrome/browser/apps/speech_recognition_browsertest.cc

Issue 24292004: Allow webkitSpeechRecognition work from an app's background page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use FakeSpeechRecognitionManager for first test to pass on bots. Created 7 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/apps/app_browsertest_util.h"
6 #include "content/public/common/content_switches.h"
7 #include "content/public/test/fake_speech_recognition_manager.h"
8
9 class SpeechRecognitionTest : public extensions::PlatformAppBrowserTest {
10 protected:
11 virtual void SetUp() OVERRIDE {
12 const testing::TestInfo* const test_info =
13 testing::UnitTest::GetInstance()->current_test_info();
14 // For SpeechRecognitionTest.SpeechFromBackgroundPage test, we need to
15 // fake the speech input to make tests run OK in bots.
16 if (!strcmp(test_info->name(), "SpeechFromBackgroundPage")) {
17 fake_speech_recognition_manager_.reset(
18 new content::FakeSpeechRecognitionManager());
19 fake_speech_recognition_manager_->set_should_send_fake_response(true);
20 // Inject the fake manager factory so that the test result is returned to
21 // the web page.
22 content::SpeechRecognitionManager::SetManagerForTests(
23 fake_speech_recognition_manager_.get());
24 }
25
26 extensions::PlatformAppBrowserTest::SetUp();
27 }
28
29 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
30 command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream);
31 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream);
32 extensions::PlatformAppBrowserTest::SetUpCommandLine(command_line);
33 }
34 private:
tapted 2013/09/24 02:53:41 nit: blank line before
lazyboy 2013/09/24 07:03:54 Done.
35 scoped_ptr<content::FakeSpeechRecognitionManager>
36 fake_speech_recognition_manager_;
37 };
tapted 2013/09/24 02:53:41 nit: DISALLOW_COPY_AND_ASSIGN(..)
lazyboy 2013/09/24 07:03:54 Done.
38
39 IN_PROC_BROWSER_TEST_F(SpeechRecognitionTest, SpeechFromBackgroundPage) {
40 ASSERT_TRUE(RunPlatformAppTest("platform_apps/speech/background_page"))
41 << message_;
42 }
43
44 IN_PROC_BROWSER_TEST_F(SpeechRecognitionTest,
45 SpeechFromBackgroundPageWithoutPermission) {
46 ASSERT_TRUE(
47 RunPlatformAppTest("platform_apps/speech/background_page_no_permission"))
48 << message_;
49 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/speech/chrome_speech_recognition_manager_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698