| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 // Stops UI loop after desired status is updated. | 522 // Stops UI loop after desired status is updated. |
| 523 void StopUILoop() { | 523 void StopUILoop() { |
| 524 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 524 EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 525 MessageLoopForUI::current()->Quit(); | 525 MessageLoopForUI::current()->Quit(); |
| 526 } | 526 } |
| 527 | 527 |
| 528 // Fetch a URL. If message_loop_started is true, starts the message loop | 528 // Fetch a URL. If message_loop_started is true, starts the message loop |
| 529 // so the caller could wait till OnURLFetchComplete is called. | 529 // so the caller could wait till OnURLFetchComplete is called. |
| 530 net::URLRequestStatus::Status FetchUrl(const GURL& url) { | 530 net::URLRequestStatus::Status FetchUrl(const GURL& url) { |
| 531 url_fetcher_.reset(content::URLFetcher::Create( | 531 url_fetcher_.reset(content::URLFetcher::Create( |
| 532 url, content::URLFetcher::GET, this)); | 532 url, net::URLFetcher::GET, this)); |
| 533 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); | 533 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); |
| 534 url_fetcher_->SetRequestContext(request_context_); | 534 url_fetcher_->SetRequestContext(request_context_); |
| 535 url_fetcher_->Start(); | 535 url_fetcher_->Start(); |
| 536 ui_test_utils::RunMessageLoop(); | 536 ui_test_utils::RunMessageLoop(); |
| 537 return response_status_; | 537 return response_status_; |
| 538 } | 538 } |
| 539 | 539 |
| 540 base::OneShotTimer<SafeBrowsingServiceTestHelper> check_update_timer_; | 540 base::OneShotTimer<SafeBrowsingServiceTestHelper> check_update_timer_; |
| 541 SafeBrowsingServiceTest* safe_browsing_test_; | 541 SafeBrowsingServiceTest* safe_browsing_test_; |
| 542 scoped_ptr<content::URLFetcher> url_fetcher_; | 542 scoped_ptr<net::URLFetcher> url_fetcher_; |
| 543 std::string response_data_; | 543 std::string response_data_; |
| 544 net::URLRequestStatus::Status response_status_; | 544 net::URLRequestStatus::Status response_status_; |
| 545 net::URLRequestContextGetter* request_context_; | 545 net::URLRequestContextGetter* request_context_; |
| 546 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceTestHelper); | 546 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServiceTestHelper); |
| 547 }; | 547 }; |
| 548 | 548 |
| 549 // See http://crbug.com/96459 | 549 // See http://crbug.com/96459 |
| 550 IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, | 550 IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, |
| 551 DISABLED_SafeBrowsingSystemTest) { | 551 DISABLED_SafeBrowsingSystemTest) { |
| 552 LOG(INFO) << "Start test"; | 552 LOG(INFO) << "Start test"; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 } | 644 } |
| 645 | 645 |
| 646 // Verifies with server if test is done and waits till server responses. | 646 // Verifies with server if test is done and waits till server responses. |
| 647 EXPECT_EQ(net::URLRequestStatus::SUCCESS, | 647 EXPECT_EQ(net::URLRequestStatus::SUCCESS, |
| 648 safe_browsing_helper->VerifyTestComplete(server_host, | 648 safe_browsing_helper->VerifyTestComplete(server_host, |
| 649 server_port, | 649 server_port, |
| 650 last_step)); | 650 last_step)); |
| 651 EXPECT_EQ("yes", safe_browsing_helper->response_data()); | 651 EXPECT_EQ("yes", safe_browsing_helper->response_data()); |
| 652 test_server.Stop(); | 652 test_server.Stop(); |
| 653 } | 653 } |
| OLD | NEW |