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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
479 // so the caller could wait till OnURLFetchComplete is called. | 479 // so the caller could wait till OnURLFetchComplete is called. |
480 net::URLRequestStatus::Status FetchUrl(const GURL& url) { | 480 net::URLRequestStatus::Status FetchUrl(const GURL& url) { |
481 url_fetcher_ = net::URLFetcher::Create(url, net::URLFetcher::GET, this); | 481 url_fetcher_ = net::URLFetcher::Create(url, net::URLFetcher::GET, this); |
482 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); | 482 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); |
483 url_fetcher_->SetRequestContext(request_context_); | 483 url_fetcher_->SetRequestContext(request_context_); |
484 url_fetcher_->Start(); | 484 url_fetcher_->Start(); |
485 content::RunMessageLoop(); | 485 content::RunMessageLoop(); |
486 return response_status_; | 486 return response_status_; |
487 } | 487 } |
488 | 488 |
489 base::OneShotTimer<SafeBrowsingServerTestHelper> check_update_timer_; | 489 base::OneShotTimer check_update_timer_; |
490 SafeBrowsingServerTest* safe_browsing_test_; | 490 SafeBrowsingServerTest* safe_browsing_test_; |
491 scoped_ptr<net::URLFetcher> url_fetcher_; | 491 scoped_ptr<net::URLFetcher> url_fetcher_; |
492 std::string response_data_; | 492 std::string response_data_; |
493 net::URLRequestStatus::Status response_status_; | 493 net::URLRequestStatus::Status response_status_; |
494 net::URLRequestContextGetter* request_context_; | 494 net::URLRequestContextGetter* request_context_; |
495 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServerTestHelper); | 495 DISALLOW_COPY_AND_ASSIGN(SafeBrowsingServerTestHelper); |
496 }; | 496 }; |
497 | 497 |
498 // TODO(shess): Disabled pending new data for third_party/safe_browsing/testing/ | 498 // TODO(shess): Disabled pending new data for third_party/safe_browsing/testing/ |
499 IN_PROC_BROWSER_TEST_F(SafeBrowsingServerTest, | 499 IN_PROC_BROWSER_TEST_F(SafeBrowsingServerTest, |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 safe_browsing_helper->FetchDBToVerify(test_server(), step)); | 574 safe_browsing_helper->FetchDBToVerify(test_server(), step)); |
575 EXPECT_GT(safe_browsing_helper->response_data().size(), 0U); | 575 EXPECT_GT(safe_browsing_helper->response_data().size(), 0U); |
576 last_step = step; | 576 last_step = step; |
577 } | 577 } |
578 | 578 |
579 // Verifies with server if test is done and waits till server responses. | 579 // Verifies with server if test is done and waits till server responses. |
580 EXPECT_EQ(net::URLRequestStatus::SUCCESS, | 580 EXPECT_EQ(net::URLRequestStatus::SUCCESS, |
581 safe_browsing_helper->VerifyTestComplete(test_server(), last_step)); | 581 safe_browsing_helper->VerifyTestComplete(test_server(), last_step)); |
582 EXPECT_EQ("yes", safe_browsing_helper->response_data()); | 582 EXPECT_EQ("yes", safe_browsing_helper->response_data()); |
583 } | 583 } |
OLD | NEW |