| 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 // this verification will fail. | 394 // this verification will fail. |
| 395 net::URLRequestStatus::Status VerifyTestComplete( | 395 net::URLRequestStatus::Status VerifyTestComplete( |
| 396 const net::TestServer& test_server, | 396 const net::TestServer& test_server, |
| 397 int test_step) { | 397 int test_step) { |
| 398 std::string path = base::StringPrintf( | 398 std::string path = base::StringPrintf( |
| 399 "%s?test_step=%d", kTestCompletePath, test_step); | 399 "%s?test_step=%d", kTestCompletePath, test_step); |
| 400 return FetchUrl(test_server.GetURL(path)); | 400 return FetchUrl(test_server.GetURL(path)); |
| 401 } | 401 } |
| 402 | 402 |
| 403 // Callback for URLFetcher. | 403 // Callback for URLFetcher. |
| 404 virtual void OnURLFetchComplete(const net::URLFetcher* source) { | 404 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE { |
| 405 source->GetResponseAsString(&response_data_); | 405 source->GetResponseAsString(&response_data_); |
| 406 response_status_ = source->GetStatus().status(); | 406 response_status_ = source->GetStatus().status(); |
| 407 StopUILoop(); | 407 StopUILoop(); |
| 408 } | 408 } |
| 409 | 409 |
| 410 const std::string& response_data() { | 410 const std::string& response_data() { |
| 411 return response_data_; | 411 return response_data_; |
| 412 } | 412 } |
| 413 | 413 |
| 414 private: | 414 private: |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 safe_browsing_helper->FetchDBToVerify(test_server(), step)); | 520 safe_browsing_helper->FetchDBToVerify(test_server(), step)); |
| 521 EXPECT_GT(safe_browsing_helper->response_data().size(), 0U); | 521 EXPECT_GT(safe_browsing_helper->response_data().size(), 0U); |
| 522 last_step = step; | 522 last_step = step; |
| 523 } | 523 } |
| 524 | 524 |
| 525 // Verifies with server if test is done and waits till server responses. | 525 // Verifies with server if test is done and waits till server responses. |
| 526 EXPECT_EQ(net::URLRequestStatus::SUCCESS, | 526 EXPECT_EQ(net::URLRequestStatus::SUCCESS, |
| 527 safe_browsing_helper->VerifyTestComplete(test_server(), last_step)); | 527 safe_browsing_helper->VerifyTestComplete(test_server(), last_step)); |
| 528 EXPECT_EQ("yes", safe_browsing_helper->response_data()); | 528 EXPECT_EQ("yes", safe_browsing_helper->response_data()); |
| 529 } | 529 } |
| OLD | NEW |