| OLD | NEW |
| 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 <list> | 5 #include <list> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 void TestAudioControllerClosed( | 85 void TestAudioControllerClosed( |
| 86 media::TestAudioInputController* controller) override { | 86 media::TestAudioInputController* controller) override { |
| 87 ASSERT_EQ(kClientAudioUpload, streaming_server_state_); | 87 ASSERT_EQ(kClientAudioUpload, streaming_server_state_); |
| 88 streaming_server_state_ = kTestAudioControllerClosed; | 88 streaming_server_state_ = kTestAudioControllerClosed; |
| 89 mock_streaming_server_->MockGoogleStreamingServer::SimulateResult( | 89 mock_streaming_server_->MockGoogleStreamingServer::SimulateResult( |
| 90 GetGoodSpeechResult()); | 90 GetGoodSpeechResult()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 // Helper methods used by test fixtures. | 93 // Helper methods used by test fixtures. |
| 94 GURL GetTestUrlFromFragment(const std::string fragment) { | 94 GURL GetTestUrlFromFragment(const std::string& fragment) { |
| 95 return GURL(GetTestUrl("speech", "web_speech_recognition.html").spec() + | 95 return GURL(GetTestUrl("speech", "web_speech_recognition.html").spec() + |
| 96 "#" + fragment); | 96 "#" + fragment); |
| 97 } | 97 } |
| 98 | 98 |
| 99 std::string GetPageFragment() { | 99 std::string GetPageFragment() { |
| 100 return shell()->web_contents()->GetLastCommittedURL().ref(); | 100 return shell()->web_contents()->GetLastCommittedURL().ref(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 const StreamingServerState &streaming_server_state() { | 103 const StreamingServerState &streaming_server_state() { |
| 104 return streaming_server_state_; | 104 return streaming_server_state_; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 202 |
| 203 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, OneShotRecognition) { | 203 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, OneShotRecognition) { |
| 204 NavigateToURLBlockUntilNavigationsComplete( | 204 NavigateToURLBlockUntilNavigationsComplete( |
| 205 shell(), GetTestUrlFromFragment("oneshot"), 2); | 205 shell(), GetTestUrlFromFragment("oneshot"), 2); |
| 206 | 206 |
| 207 EXPECT_EQ(kClientDisconnected, streaming_server_state()); | 207 EXPECT_EQ(kClientDisconnected, streaming_server_state()); |
| 208 EXPECT_EQ("goodresult1", GetPageFragment()); | 208 EXPECT_EQ("goodresult1", GetPageFragment()); |
| 209 } | 209 } |
| 210 | 210 |
| 211 } // namespace content | 211 } // namespace content |
| OLD | NEW |