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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 if (urls[i].empty()) | 84 if (urls[i].empty()) |
85 continue; | 85 continue; |
86 PhishingUrl phishing_url; | 86 PhishingUrl phishing_url; |
87 std::vector<std::string> record_parts; | 87 std::vector<std::string> record_parts; |
88 base::SplitString(urls[i], '\t', &record_parts); | 88 base::SplitString(urls[i], '\t', &record_parts); |
89 if (record_parts.size() != 3) { | 89 if (record_parts.size() != 3) { |
90 LOG(ERROR) << "Unexpected URL format in phishing URL list: " | 90 LOG(ERROR) << "Unexpected URL format in phishing URL list: " |
91 << urls[i]; | 91 << urls[i]; |
92 return false; | 92 return false; |
93 } | 93 } |
94 phishing_url.url = std::string(content::kHttpScheme) + | 94 phishing_url.url = std::string(url::kHttpScheme) + "://" + record_parts[0]; |
95 "://" + record_parts[0]; | |
96 phishing_url.list_name = record_parts[1]; | 95 phishing_url.list_name = record_parts[1]; |
97 if (record_parts[2] == "yes") { | 96 if (record_parts[2] == "yes") { |
98 phishing_url.is_phishing = true; | 97 phishing_url.is_phishing = true; |
99 } else if (record_parts[2] == "no") { | 98 } else if (record_parts[2] == "no") { |
100 phishing_url.is_phishing = false; | 99 phishing_url.is_phishing = false; |
101 } else { | 100 } else { |
102 LOG(ERROR) << "Unrecognized expectation in " << urls[i] | 101 LOG(ERROR) << "Unrecognized expectation in " << urls[i] |
103 << ": " << record_parts[2]; | 102 << ": " << record_parts[2]; |
104 return false; | 103 return false; |
105 } | 104 } |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 safe_browsing_helper->FetchDBToVerify(test_server(), step)); | 568 safe_browsing_helper->FetchDBToVerify(test_server(), step)); |
570 EXPECT_GT(safe_browsing_helper->response_data().size(), 0U); | 569 EXPECT_GT(safe_browsing_helper->response_data().size(), 0U); |
571 last_step = step; | 570 last_step = step; |
572 } | 571 } |
573 | 572 |
574 // Verifies with server if test is done and waits till server responses. | 573 // Verifies with server if test is done and waits till server responses. |
575 EXPECT_EQ(net::URLRequestStatus::SUCCESS, | 574 EXPECT_EQ(net::URLRequestStatus::SUCCESS, |
576 safe_browsing_helper->VerifyTestComplete(test_server(), last_step)); | 575 safe_browsing_helper->VerifyTestComplete(test_server(), last_step)); |
577 EXPECT_EQ("yes", safe_browsing_helper->response_data()); | 576 EXPECT_EQ("yes", safe_browsing_helper->response_data()); |
578 } | 577 } |
OLD | NEW |