OLD | NEW |
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 // This test uses the safebrowsing test server published at | 5 // This test uses the safebrowsing test server published at |
6 // http://code.google.com/p/google-safe-browsing/ to test the safebrowsing | 6 // http://code.google.com/p/google-safe-browsing/ to test the safebrowsing |
7 // protocol implemetation. Details of the safebrowsing testing flow is | 7 // protocol implemetation. Details of the safebrowsing testing flow is |
8 // documented at | 8 // documented at |
9 // http://code.google.com/p/google-safe-browsing/wiki/ProtocolTesting | 9 // http://code.google.com/p/google-safe-browsing/wiki/ProtocolTesting |
10 // | 10 // |
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 void StopUILoop() { | 519 void StopUILoop() { |
520 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 520 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
521 MessageLoopForUI::current()->Quit(); | 521 MessageLoopForUI::current()->Quit(); |
522 } | 522 } |
523 | 523 |
524 // Fetch a URL. If message_loop_started is true, starts the message loop | 524 // Fetch a URL. If message_loop_started is true, starts the message loop |
525 // so the caller could wait till OnURLFetchComplete is called. | 525 // so the caller could wait till OnURLFetchComplete is called. |
526 net::URLRequestStatus::Status FetchUrl(const GURL& url) { | 526 net::URLRequestStatus::Status FetchUrl(const GURL& url) { |
527 url_fetcher_.reset(new URLFetcher(url, URLFetcher::GET, this)); | 527 url_fetcher_.reset(new URLFetcher(url, URLFetcher::GET, this)); |
528 url_fetcher_->set_load_flags(net::LOAD_DISABLE_CACHE); | 528 url_fetcher_->set_load_flags(net::LOAD_DISABLE_CACHE); |
529 url_fetcher_->set_request_context(Profile::GetDefaultRequestContext()); | 529 url_fetcher_->set_request_context( |
| 530 Profile::Deprecated::GetDefaultRequestContext()); |
530 url_fetcher_->Start(); | 531 url_fetcher_->Start(); |
531 ui_test_utils::RunMessageLoop(); | 532 ui_test_utils::RunMessageLoop(); |
532 return response_status_; | 533 return response_status_; |
533 } | 534 } |
534 | 535 |
535 base::OneShotTimer<SafeBrowsingServiceTestHelper> check_update_timer_; | 536 base::OneShotTimer<SafeBrowsingServiceTestHelper> check_update_timer_; |
536 SafeBrowsingServiceTest* safe_browsing_test_; | 537 SafeBrowsingServiceTest* safe_browsing_test_; |
537 scoped_ptr<URLFetcher> url_fetcher_; | 538 scoped_ptr<URLFetcher> url_fetcher_; |
538 std::string response_data_; | 539 std::string response_data_; |
539 net::URLRequestStatus::Status response_status_; | 540 net::URLRequestStatus::Status response_status_; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
636 } | 637 } |
637 | 638 |
638 // Verifies with server if test is done and waits till server responses. | 639 // Verifies with server if test is done and waits till server responses. |
639 EXPECT_EQ(net::URLRequestStatus::SUCCESS, | 640 EXPECT_EQ(net::URLRequestStatus::SUCCESS, |
640 safe_browsing_helper->VerifyTestComplete(server_host, | 641 safe_browsing_helper->VerifyTestComplete(server_host, |
641 server_port, | 642 server_port, |
642 last_step)); | 643 last_step)); |
643 EXPECT_EQ("yes", safe_browsing_helper->response_data()); | 644 EXPECT_EQ("yes", safe_browsing_helper->response_data()); |
644 test_server.Stop(); | 645 test_server.Stop(); |
645 } | 646 } |
OLD | NEW |