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 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 // bad URL that server expects test to fetch full hash but the test didn't, | 498 // bad URL that server expects test to fetch full hash but the test didn't, |
499 // this verification will fail. | 499 // this verification will fail. |
500 net::URLRequestStatus::Status VerifyTestComplete(const char* host, int port, | 500 net::URLRequestStatus::Status VerifyTestComplete(const char* host, int port, |
501 int test_step) { | 501 int test_step) { |
502 GURL url(StringPrintf("http://%s:%d%s?test_step=%d", | 502 GURL url(StringPrintf("http://%s:%d%s?test_step=%d", |
503 host, port, kTestCompletePath, test_step)); | 503 host, port, kTestCompletePath, test_step)); |
504 return FetchUrl(url); | 504 return FetchUrl(url); |
505 } | 505 } |
506 | 506 |
507 // Callback for URLFetcher. | 507 // Callback for URLFetcher. |
508 virtual void OnURLFetchComplete(const content::URLFetcher* source) { | 508 virtual void OnURLFetchComplete(const net::URLFetcher* source) { |
509 source->GetResponseAsString(&response_data_); | 509 source->GetResponseAsString(&response_data_); |
510 response_status_ = source->GetStatus().status(); | 510 response_status_ = source->GetStatus().status(); |
511 StopUILoop(); | 511 StopUILoop(); |
512 } | 512 } |
513 | 513 |
514 const std::string& response_data() { | 514 const std::string& response_data() { |
515 return response_data_; | 515 return response_data_; |
516 } | 516 } |
517 | 517 |
518 private: | 518 private: |
(...skipping 125 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 |