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 creates a fake safebrowsing service, where we can inject known- | 5 // This test creates a fake safebrowsing service, where we can inject known- |
6 // threat urls. It then uses a real browser to go to these urls, and sends | 6 // threat urls. It then uses a real browser to go to these urls, and sends |
7 // "goback" or "proceed" commands and verifies they work. | 7 // "goback" or "proceed" commands and verifies they work. |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 if (!interstitial) | 503 if (!interstitial) |
504 return false; | 504 return false; |
505 return content::WaitForRenderFrameReady(interstitial->GetMainFrame()); | 505 return content::WaitForRenderFrameReady(interstitial->GetMainFrame()); |
506 } | 506 } |
507 | 507 |
508 Visibility GetVisibility(const std::string& node_id) { | 508 Visibility GetVisibility(const std::string& node_id) { |
509 content::RenderFrameHost* rfh = GetRenderFrameHost(); | 509 content::RenderFrameHost* rfh = GetRenderFrameHost(); |
510 if (!rfh) | 510 if (!rfh) |
511 return VISIBILITY_ERROR; | 511 return VISIBILITY_ERROR; |
512 | 512 |
513 scoped_ptr<base::Value> value = content::ExecuteScriptAndGetValue( | 513 std::unique_ptr<base::Value> value = content::ExecuteScriptAndGetValue( |
514 rfh, "var node = document.getElementById('" + node_id + | 514 rfh, "var node = document.getElementById('" + node_id + |
515 "');\n" | 515 "');\n" |
516 "if (node)\n" | 516 "if (node)\n" |
517 " node.offsetWidth > 0 && node.offsetHeight > 0;" | 517 " node.offsetWidth > 0 && node.offsetHeight > 0;" |
518 "else\n" | 518 "else\n" |
519 " 'node not found';\n"); | 519 " 'node not found';\n"); |
520 if (!value.get()) | 520 if (!value.get()) |
521 return VISIBILITY_ERROR; | 521 return VISIBILITY_ERROR; |
522 | 522 |
523 bool result = false; | 523 bool result = false; |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1142 | 1142 |
1143 INSTANTIATE_TEST_CASE_P( | 1143 INSTANTIATE_TEST_CASE_P( |
1144 SafeBrowsingBlockingPageIDNTestWithThreatType, | 1144 SafeBrowsingBlockingPageIDNTestWithThreatType, |
1145 SafeBrowsingBlockingPageIDNTest, | 1145 SafeBrowsingBlockingPageIDNTest, |
1146 testing::Combine(testing::Values(false, true), | 1146 testing::Combine(testing::Values(false, true), |
1147 testing::Values(SB_THREAT_TYPE_URL_MALWARE, | 1147 testing::Values(SB_THREAT_TYPE_URL_MALWARE, |
1148 SB_THREAT_TYPE_URL_PHISHING, | 1148 SB_THREAT_TYPE_URL_PHISHING, |
1149 SB_THREAT_TYPE_URL_UNWANTED))); | 1149 SB_THREAT_TYPE_URL_UNWANTED))); |
1150 | 1150 |
1151 } // namespace safe_browsing | 1151 } // namespace safe_browsing |
OLD | NEW |