OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 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 "base/command_line.h" |
| 6 #include "base/file_path.h" |
| 7 #include "chrome/browser/browser.h" |
| 8 #include "chrome/browser/tab_contents/tab_contents.h" |
| 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/test/in_process_browser_test.h" |
| 11 #include "chrome/test/ui_test_utils.h" |
| 12 |
| 13 class SpeechInputEnableSwitchTest : public InProcessBrowserTest { |
| 14 public: |
| 15 GURL testUrl(const FilePath::CharType* filename) { |
| 16 const FilePath kTestDir(FILE_PATH_LITERAL("speech")); |
| 17 return ui_test_utils::GetTestUrl(kTestDir, FilePath(filename)); |
| 18 } |
| 19 }; |
| 20 |
| 21 IN_PROC_BROWSER_TEST_F(SpeechInputEnableSwitchTest, UnavailabilityTest) { |
| 22 // Test that speech input is not available to a web page if |
| 23 // the runtime switch is disabled. |
| 24 |
| 25 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 26 bool has_switch = command_line.HasSwitch(switches::kEnableSpeechInput); |
| 27 ASSERT_FALSE(has_switch) << "This test does not make sense if " |
| 28 << "--enable-speech-input is set."; |
| 29 |
| 30 GURL test_url = testUrl( |
| 31 FILE_PATH_LITERAL("enable_speech_input_switch_test.html")); |
| 32 ui_test_utils::NavigateToURL(browser(), test_url); |
| 33 std::string status = browser()->GetSelectedTabContents()->GetURL().ref(); |
| 34 EXPECT_EQ("pass", status) << "Page detected speech input properties."; |
| 35 } |
| 36 |
OLD | NEW |