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

Side by Side Diff: chrome_frame/test/test_with_web_server.h

Issue 7276037: Remove NPAPI support from Chrome Frame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « chrome_frame/test/chrome_frame_test_utils.cc ('k') | chrome_frame/test/test_with_web_server.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_ 5 #ifndef CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_
6 #define CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_ 6 #define CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <windows.h> 9 #include <windows.h>
10 #include <string> 10 #include <string>
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 133 }
134 134
135 private: 135 private:
136 // Holds the results of tests which post success/failure. 136 // Holds the results of tests which post success/failure.
137 std::string posted_result_; 137 std::string posted_result_;
138 std::string expected_result_; 138 std::string expected_result_;
139 }; 139 };
140 140
141 // Class that: 141 // Class that:
142 // 1) Starts the local webserver, 142 // 1) Starts the local webserver,
143 // 2) Supports launching browsers - Internet Explorer and Firefox with local url 143 // 2) Supports launching browsers - Internet Explorer with local url
144 // 3) Wait the webserver to finish. It is supposed the test webpage to shutdown 144 // 3) Wait the webserver to finish. It is supposed the test webpage to shutdown
145 // the server by navigating to "kill" page 145 // the server by navigating to "kill" page
146 // 4) Supports read the posted results from the test webpage to the "dump" 146 // 4) Supports read the posted results from the test webpage to the "dump"
147 // webserver directory 147 // webserver directory
148 class ChromeFrameTestWithWebServer: public testing::Test { 148 class ChromeFrameTestWithWebServer: public testing::Test {
149 public: 149 public:
150 ChromeFrameTestWithWebServer(); 150 ChromeFrameTestWithWebServer();
151 151
152 protected: 152 protected:
153 enum BrowserKind { INVALID, IE, FIREFOX, OPERA, SAFARI, CHROME }; 153 enum BrowserKind { INVALID, IE, CHROME };
154 154
155 bool LaunchBrowser(BrowserKind browser, const wchar_t* url); 155 bool LaunchBrowser(BrowserKind browser, const wchar_t* url);
156 bool WaitForTestToComplete(int milliseconds); 156 bool WaitForTestToComplete(int milliseconds);
157 // Waits for the page to notify us of the window.onload event firing. 157 // Waits for the page to notify us of the window.onload event firing.
158 // Note that the milliseconds value is only approximate. 158 // Note that the milliseconds value is only approximate.
159 bool WaitForOnLoad(int milliseconds); 159 bool WaitForOnLoad(int milliseconds);
160 160
161 // Launches the specified browser and waits for the test to complete 161 // Launches the specified browser and waits for the test to complete
162 // (see WaitForTestToComplete). Then checks that the outcome is equal 162 // (see WaitForTestToComplete). Then checks that the outcome is equal
163 // to the expected result. 163 // to the expected result.
164 // This function uses EXPECT_TRUE and ASSERT_TRUE for all steps performed 164 // This function uses EXPECT_TRUE and ASSERT_TRUE for all steps performed
165 // hence no return value. 165 // hence no return value.
166 void SimpleBrowserTestExpectedResult(BrowserKind browser, 166 void SimpleBrowserTestExpectedResult(BrowserKind browser,
167 const wchar_t* page, const char* result); 167 const wchar_t* page, const char* result);
168 void SimpleBrowserTest(BrowserKind browser, const wchar_t* page); 168 void SimpleBrowserTest(BrowserKind browser, const wchar_t* page);
169 169
170 // Same as SimpleBrowserTest but if the browser isn't installed (LaunchBrowser
171 // fails), the function will print out a warning but not treat the test
172 // as failed.
173 // Currently this is how we run Opera tests.
174 void OptionalBrowserTest(BrowserKind browser, const wchar_t* page);
175
176 // Test if chrome frame correctly reports its version. 170 // Test if chrome frame correctly reports its version.
177 void VersionTest(BrowserKind browser, const wchar_t* page); 171 void VersionTest(BrowserKind browser, const wchar_t* page);
178 172
179 // Closes all browsers in preparation for a test and during cleanup. 173 // Closes all browsers in preparation for a test and during cleanup.
180 void CloseAllBrowsers(); 174 void CloseAllBrowsers();
181 175
182 void CloseBrowser(); 176 void CloseBrowser();
183 177
184 // Ensures (well, at least tries to ensure) that the browser window has focus. 178 // Ensures (well, at least tries to ensure) that the browser window has focus.
185 bool BringBrowserToTop(); 179 bool BringBrowserToTop();
186 180
187 const FilePath& GetCFTestFilePath() { 181 const FilePath& GetCFTestFilePath() {
188 return test_file_path_; 182 return test_file_path_;
189 } 183 }
190 184
191 virtual void SetUp(); 185 virtual void SetUp();
192 virtual void TearDown(); 186 virtual void TearDown();
193 187
194 // Important: kind means "sheep" in Icelandic. ?:-o 188 // Important: kind means "sheep" in Icelandic. ?:-o
195 const char* ToString(BrowserKind kind) { 189 const char* ToString(BrowserKind kind) {
196 switch (kind) { 190 switch (kind) {
197 case IE: 191 case IE:
198 return "IE"; 192 return "IE";
199 case FIREFOX:
200 return "Firefox";
201 case OPERA:
202 return "Opera";
203 case CHROME: 193 case CHROME:
204 return "Chrome"; 194 return "Chrome";
205 case SAFARI:
206 return "Safari";
207 default: 195 default:
208 NOTREACHED(); 196 NOTREACHED();
209 break; 197 break;
210 } 198 }
211 return ""; 199 return "";
212 } 200 }
213 201
214 BrowserKind browser_; 202 BrowserKind browser_;
215 FilePath results_dir_; 203 FilePath results_dir_;
216 base::win::ScopedHandle browser_handle_; 204 base::win::ScopedHandle browser_handle_;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 // Same as above except that the response does not include the no-cache header. 323 // Same as above except that the response does not include the no-cache header.
336 ACTION_P2(SendAllowCacheResponse, server, invocation) { 324 ACTION_P2(SendAllowCacheResponse, server, invocation) {
337 server->SendResponseHelper(arg0, arg1, invocation, false); 325 server->SendResponseHelper(arg0, arg1, invocation, false);
338 } 326 }
339 327
340 ACTION_P2(HandlePostedResponseHelper, server, invocation) { 328 ACTION_P2(HandlePostedResponseHelper, server, invocation) {
341 server->HandlePostedResponse(arg0, arg2); 329 server->HandlePostedResponse(arg0, arg2);
342 } 330 }
343 331
344 #endif // CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_ 332 #endif // CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_
OLDNEW
« no previous file with comments | « chrome_frame/test/chrome_frame_test_utils.cc ('k') | chrome_frame/test/test_with_web_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698