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

Side by Side Diff: chrome/browser/net/url_fetcher_unittest.cc

Issue 18499: Replace cases of Append(FILE_PATH_LITERAL()) with AppendASCII(""). (Closed)
Patch Set: Created 11 years, 11 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
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/thread.h" 5 #include "base/thread.h"
6 #include "base/time.h" 6 #include "base/time.h"
7 #include "chrome/browser/net/url_fetcher.h" 7 #include "chrome/browser/net/url_fetcher.h"
8 #include "chrome/browser/net/url_fetcher_protect.h" 8 #include "chrome/browser/net/url_fetcher_protect.h"
9 #if defined(OS_LINUX) 9 #if defined(OS_LINUX)
10 // TODO(port): ugly hack for linux 10 // TODO(port): ugly hack for linux
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 // it takes more than 1 second due to the overload pretection settings. 269 // it takes more than 1 second due to the overload pretection settings.
270 EXPECT_TRUE(Time::Now() - start_time_ >= one_second); 270 EXPECT_TRUE(Time::Now() - start_time_ >= one_second);
271 URLFetcherTest::OnURLFetchComplete(source, url, status, response_code, 271 URLFetcherTest::OnURLFetchComplete(source, url, status, response_code,
272 cookies, data); 272 cookies, data);
273 } 273 }
274 } 274 }
275 } 275 }
276 276
277 URLFetcherBadHTTPSTest::URLFetcherBadHTTPSTest() { 277 URLFetcherBadHTTPSTest::URLFetcherBadHTTPSTest() {
278 PathService::Get(base::DIR_SOURCE_ROOT, &cert_dir_); 278 PathService::Get(base::DIR_SOURCE_ROOT, &cert_dir_);
279 cert_dir_ = cert_dir_.Append(FILE_PATH_LITERAL("chrome")); 279 cert_dir_ = cert_dir_.AppendASCII("chrome");
280 cert_dir_ = cert_dir_.Append(FILE_PATH_LITERAL("test")); 280 cert_dir_ = cert_dir_.AppendASCII("test");
281 cert_dir_ = cert_dir_.Append(FILE_PATH_LITERAL("data")); 281 cert_dir_ = cert_dir_.AppendASCII("data");
282 cert_dir_ = cert_dir_.Append(FILE_PATH_LITERAL("ssl")); 282 cert_dir_ = cert_dir_.AppendASCII("ssl");
283 cert_dir_ = cert_dir_.Append(FILE_PATH_LITERAL("certificates")); 283 cert_dir_ = cert_dir_.AppendASCII("certificates");
284 } 284 }
285 285
286 // The "server certificate expired" error should result in automatic 286 // The "server certificate expired" error should result in automatic
287 // cancellation of the request by 287 // cancellation of the request by
288 // URLRequest::Delegate::OnSSLCertificateError. 288 // URLRequest::Delegate::OnSSLCertificateError.
289 void URLFetcherBadHTTPSTest::OnURLFetchComplete( 289 void URLFetcherBadHTTPSTest::OnURLFetchComplete(
290 const URLFetcher* source, 290 const URLFetcher* source,
291 const GURL& url, 291 const GURL& url,
292 const URLRequestStatus& status, 292 const URLRequestStatus& status,
293 int response_code, 293 int response_code,
294 const ResponseCookies& cookies, 294 const ResponseCookies& cookies,
295 const std::string& data) { 295 const std::string& data) {
296 // This part is different from URLFetcherTest::OnURLFetchComplete 296 // This part is different from URLFetcherTest::OnURLFetchComplete
297 // because this test expects the request to be cancelled. 297 // because this test expects the request to be cancelled.
298 EXPECT_EQ(URLRequestStatus::CANCELED, status.status()); 298 EXPECT_EQ(URLRequestStatus::CANCELED, status.status());
299 EXPECT_EQ(net::ERR_ABORTED, status.os_error()); 299 EXPECT_EQ(net::ERR_ABORTED, status.os_error());
300 EXPECT_EQ(-1, response_code); 300 EXPECT_EQ(-1, response_code);
301 EXPECT_TRUE(cookies.empty()); 301 EXPECT_TRUE(cookies.empty());
302 EXPECT_TRUE(data.empty()); 302 EXPECT_TRUE(data.empty());
303 303
304 // The rest is the same as URLFetcherTest::OnURLFetchComplete. 304 // The rest is the same as URLFetcherTest::OnURLFetchComplete.
305 delete fetcher_; 305 delete fetcher_;
306 io_loop_.Quit(); 306 io_loop_.Quit();
307 } 307 }
308 308
309 FilePath URLFetcherBadHTTPSTest::GetExpiredCertPath() { 309 FilePath URLFetcherBadHTTPSTest::GetExpiredCertPath() {
310 return cert_dir_.Append(FILE_PATH_LITERAL("expired_cert.pem")); 310 return cert_dir_.AppendASCII("expired_cert.pem");
311 } 311 }
312 312
313 void URLFetcherCancelTest::CreateFetcher(const GURL& url) { 313 void URLFetcherCancelTest::CreateFetcher(const GURL& url) {
314 fetcher_ = new URLFetcher(url, URLFetcher::GET, this); 314 fetcher_ = new URLFetcher(url, URLFetcher::GET, this);
315 fetcher_->set_request_context( 315 fetcher_->set_request_context(
316 new CancelTestURLRequestContext(&context_released_)); 316 new CancelTestURLRequestContext(&context_released_));
317 fetcher_->set_io_loop(&io_loop_); 317 fetcher_->set_io_loop(&io_loop_);
318 fetcher_->Start(); 318 fetcher_->Start();
319 // Make sure we give the IO thread a chance to run. 319 // Make sure we give the IO thread a chance to run.
320 timer_.Start(TimeDelta::FromMilliseconds(100), this, 320 timer_.Start(TimeDelta::FromMilliseconds(100), this,
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 // (main) thread will do the IO, and when the fetch is complete it will 470 // (main) thread will do the IO, and when the fetch is complete it will
471 // terminate the main thread's message loop; then the other thread's 471 // terminate the main thread's message loop; then the other thread's
472 // message loop will be shut down automatically as the thread goes out of 472 // message loop will be shut down automatically as the thread goes out of
473 // scope. 473 // scope.
474 base::Thread t("URLFetcher test thread"); 474 base::Thread t("URLFetcher test thread");
475 t.Start(); 475 t.Start();
476 t.message_loop()->PostTask(FROM_HERE, new FetcherWrapperTask(this, url)); 476 t.message_loop()->PostTask(FROM_HERE, new FetcherWrapperTask(this, url));
477 477
478 MessageLoop::current()->Run(); 478 MessageLoop::current()->Run();
479 } 479 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/firefox2_importer.cc ('k') | chrome/browser/safe_browsing/safe_browsing_database_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698