OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "chrome/renderer/safe_browsing/threat_dom_details.h" | 5 #include "chrome/renderer/safe_browsing/threat_dom_details.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "chrome/common/safe_browsing/safebrowsing_messages.h" | 10 #include "chrome/common/safe_browsing/safebrowsing_messages.h" |
11 #include "chrome/test/base/chrome_render_view_test.h" | 11 #include "chrome/test/base/chrome_render_view_test.h" |
12 #include "content/public/renderer/render_view.h" | 12 #include "content/public/renderer/render_view.h" |
13 #include "net/base/escape.h" | 13 #include "net/base/escape.h" |
| 14 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
| 15 #include "ui/native_theme/native_theme_switches.h" |
14 | 16 |
15 typedef ChromeRenderViewTest ThreatDOMDetailsTest; | 17 typedef ChromeRenderViewTest ThreatDOMDetailsTest; |
16 | 18 |
17 TEST_F(ThreatDOMDetailsTest, Everything) { | 19 TEST_F(ThreatDOMDetailsTest, Everything) { |
| 20 blink::WebRuntimeFeatures::enableOverlayScrollbars( |
| 21 ui::IsOverlayScrollbarEnabled()); |
18 std::unique_ptr<safe_browsing::ThreatDOMDetails> details( | 22 std::unique_ptr<safe_browsing::ThreatDOMDetails> details( |
19 safe_browsing::ThreatDOMDetails::Create(view_->GetMainRenderFrame())); | 23 safe_browsing::ThreatDOMDetails::Create(view_->GetMainRenderFrame())); |
20 // Lower kMaxNodes for the test. Loading 500 subframes in a | 24 // Lower kMaxNodes for the test. Loading 500 subframes in a |
21 // debug build takes a while. | 25 // debug build takes a while. |
22 details->kMaxNodes = 50; | 26 details->kMaxNodes = 50; |
23 | 27 |
24 const char urlprefix[] = "data:text/html;charset=utf-8,"; | 28 const char urlprefix[] = "data:text/html;charset=utf-8,"; |
25 | 29 |
26 { | 30 { |
27 // A page with an internal script | 31 // A page with an internal script |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 "\"></script>"; | 128 "\"></script>"; |
125 } | 129 } |
126 GURL url(urlprefix + html); | 130 GURL url(urlprefix + html); |
127 | 131 |
128 LoadHTML(html.c_str()); | 132 LoadHTML(html.c_str()); |
129 std::vector<SafeBrowsingHostMsg_ThreatDOMDetails_Node> params; | 133 std::vector<SafeBrowsingHostMsg_ThreatDOMDetails_Node> params; |
130 details->ExtractResources(¶ms); | 134 details->ExtractResources(¶ms); |
131 ASSERT_EQ(51u, params.size()); | 135 ASSERT_EQ(51u, params.size()); |
132 } | 136 } |
133 } | 137 } |
OLD | NEW |