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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 GetGoodSpeechResult()); | 87 GetGoodSpeechResult()); |
88 } | 88 } |
89 | 89 |
90 // Helper methods used by test fixtures. | 90 // Helper methods used by test fixtures. |
91 GURL GetTestUrlFromFragment(const std::string fragment) { | 91 GURL GetTestUrlFromFragment(const std::string fragment) { |
92 return GURL(GetTestUrl("speech", "web_speech_recognition.html").spec() + | 92 return GURL(GetTestUrl("speech", "web_speech_recognition.html").spec() + |
93 "#" + fragment); | 93 "#" + fragment); |
94 } | 94 } |
95 | 95 |
96 std::string GetPageFragment() { | 96 std::string GetPageFragment() { |
97 return shell()->web_contents()->GetURL().ref(); | 97 return shell()->web_contents()->GetLastCommittedURL().ref(); |
98 } | 98 } |
99 | 99 |
100 const StreamingServerState &streaming_server_state() { | 100 const StreamingServerState &streaming_server_state() { |
101 return streaming_server_state_; | 101 return streaming_server_state_; |
102 } | 102 } |
103 | 103 |
104 protected: | 104 protected: |
105 // ContentBrowserTest methods. | 105 // ContentBrowserTest methods. |
106 void SetUpInProcessBrowserTestFixture() override { | 106 void SetUpInProcessBrowserTestFixture() override { |
107 test_audio_input_controller_factory_.set_delegate(this); | 107 test_audio_input_controller_factory_.set_delegate(this); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 199 |
200 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, OneShotRecognition) { | 200 IN_PROC_BROWSER_TEST_F(SpeechRecognitionBrowserTest, OneShotRecognition) { |
201 NavigateToURLBlockUntilNavigationsComplete( | 201 NavigateToURLBlockUntilNavigationsComplete( |
202 shell(), GetTestUrlFromFragment("oneshot"), 2); | 202 shell(), GetTestUrlFromFragment("oneshot"), 2); |
203 | 203 |
204 EXPECT_EQ(kClientDisconnected, streaming_server_state()); | 204 EXPECT_EQ(kClientDisconnected, streaming_server_state()); |
205 EXPECT_EQ("goodresult1", GetPageFragment()); | 205 EXPECT_EQ("goodresult1", GetPageFragment()); |
206 } | 206 } |
207 | 207 |
208 } // namespace content | 208 } // namespace content |
OLD | NEW |