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

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

Issue 1409163006: Migrating tests to use EmbeddedTestServer (/chrome/browser misc) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 1 month 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "base/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h" 6 #include "chrome/browser/speech/chrome_speech_recognition_manager_delegate.h"
7 #include "chrome/browser/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_commands.h" 8 #include "chrome/browser/ui/browser_commands.h"
9 #include "chrome/browser/ui/tabs/tab_strip_model.h" 9 #include "chrome/browser/ui/tabs/tab_strip_model.h"
10 #include "chrome/test/base/in_process_browser_test.h" 10 #include "chrome/test/base/in_process_browser_test.h"
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 bool render_view_host_changed_; 73 bool render_view_host_changed_;
74 bool web_contents_destroyed_; 74 bool web_contents_destroyed_;
75 75
76 DISALLOW_COPY_AND_ASSIGN(SpeechWebContentsObserver); 76 DISALLOW_COPY_AND_ASSIGN(SpeechWebContentsObserver);
77 }; 77 };
78 78
79 // Tests that ChromeSpeechRecognitionManagerDelegate works properly 79 // Tests that ChromeSpeechRecognitionManagerDelegate works properly
80 // when a WebContents goes away (WCO::WebContentsDestroyed) or the RVH 80 // when a WebContents goes away (WCO::WebContentsDestroyed) or the RVH
81 // changes within a WebContents (WCO::RenderViewHostChanged). 81 // changes within a WebContents (WCO::RenderViewHostChanged).
82 IN_PROC_BROWSER_TEST_F(ChromeSpeechRecognitionTest, BasicTearDown) { 82 IN_PROC_BROWSER_TEST_F(ChromeSpeechRecognitionTest, BasicTearDown) {
83 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 83 ASSERT_TRUE(embedded_test_server()->Start());
84 net::SpawnedTestServer::SSLOptions ssl_options; 84 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS);
85 net::SpawnedTestServer https_server( 85 https_server.ServeFilesFromSourceDirectory("chrome/test/data");
86 net::SpawnedTestServer::TYPE_HTTPS, ssl_options,
87 base::FilePath(FILE_PATH_LITERAL("chrome/test/data")));
88 ASSERT_TRUE(https_server.Start()); 86 ASSERT_TRUE(https_server.Start());
89 87
90 GURL http_url = 88 GURL http_url =
91 embedded_test_server()->GetURL("/speech/web_speech_test.html"); 89 embedded_test_server()->GetURL("/speech/web_speech_test.html");
92 GURL https_url(https_server.GetURL("files/speech/web_speech_test.html")); 90 GURL https_url(https_server.GetURL("/speech/web_speech_test.html"));
93 91
94 scoped_ptr<ChromeSpeechRecognitionManagerDelegate> delegate( 92 scoped_ptr<ChromeSpeechRecognitionManagerDelegate> delegate(
95 new ChromeSpeechRecognitionManagerDelegate()); 93 new ChromeSpeechRecognitionManagerDelegate());
96 static_cast<content::FakeSpeechRecognitionManager*>( 94 static_cast<content::FakeSpeechRecognitionManager*>(
97 fake_speech_recognition_manager_.get())->SetDelegate(delegate.get()); 95 fake_speech_recognition_manager_.get())->SetDelegate(delegate.get());
98 96
99 ui_test_utils::NavigateToURL(browser(), http_url); 97 ui_test_utils::NavigateToURL(browser(), http_url);
100 WebContents* web_contents = 98 WebContents* web_contents =
101 browser()->tab_strip_model()->GetActiveWebContents(); 99 browser()->tab_strip_model()->GetActiveWebContents();
102 EXPECT_TRUE(web_contents); 100 EXPECT_TRUE(web_contents);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 web_contents, kRetriveTranscriptScript, &output)); 138 web_contents, kRetriveTranscriptScript, &output));
141 EXPECT_EQ(kExpectedTranscript, output); 139 EXPECT_EQ(kExpectedTranscript, output);
142 } 140 }
143 141
144 // Close the tab to so that we see WCO::WebContentsDestroyed(). 142 // Close the tab to so that we see WCO::WebContentsDestroyed().
145 chrome::CloseTab(browser()); 143 chrome::CloseTab(browser());
146 EXPECT_TRUE(speech_contents_observer.web_contents_destroyed()); 144 EXPECT_TRUE(speech_contents_observer.web_contents_destroyed());
147 } 145 }
148 146
149 } // namespace speech 147 } // namespace speech
OLDNEW
« no previous file with comments | « chrome/browser/site_details_browsertest.cc ('k') | chrome/browser/storage/durable_storage_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698