OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/test_runner/mock_content_settings_client.h" | 5 #include "content/shell/test_runner/mock_content_settings_client.h" |
6 | 6 |
7 #include "components/test_runner/layout_test_runtime_flags.h" | 7 #include "content/shell/test_runner/layout_test_runtime_flags.h" |
8 #include "components/test_runner/test_common.h" | 8 #include "content/shell/test_runner/test_common.h" |
9 #include "components/test_runner/web_test_delegate.h" | 9 #include "content/shell/test_runner/web_test_delegate.h" |
10 #include "third_party/WebKit/public/platform/WebURL.h" | 10 #include "third_party/WebKit/public/platform/WebURL.h" |
11 | 11 |
12 namespace test_runner { | 12 namespace test_runner { |
13 | 13 |
14 MockContentSettingsClient::MockContentSettingsClient( | 14 MockContentSettingsClient::MockContentSettingsClient( |
15 LayoutTestRuntimeFlags* layout_test_runtime_flags) | 15 LayoutTestRuntimeFlags* layout_test_runtime_flags) |
16 : delegate_(nullptr), flags_(layout_test_runtime_flags) {} | 16 : delegate_(nullptr), flags_(layout_test_runtime_flags) {} |
17 | 17 |
18 MockContentSettingsClient::~MockContentSettingsClient() {} | 18 MockContentSettingsClient::~MockContentSettingsClient() {} |
19 | 19 |
20 bool MockContentSettingsClient::allowImage(bool enabled_per_settings, | 20 bool MockContentSettingsClient::allowImage(bool enabled_per_settings, |
21 const blink::WebURL& image_url) { | 21 const blink::WebURL& image_url) { |
22 bool allowed = enabled_per_settings && flags_->images_allowed(); | 22 bool allowed = enabled_per_settings && flags_->images_allowed(); |
23 if (flags_->dump_web_content_settings_client_callbacks() && delegate_) { | 23 if (flags_->dump_web_content_settings_client_callbacks() && delegate_) { |
24 delegate_->PrintMessage( | 24 delegate_->PrintMessage( |
25 std::string("MockContentSettingsClient: allowImage(") + | 25 std::string("MockContentSettingsClient: allowImage(") + |
26 NormalizeLayoutTestURL(image_url.string().utf8()) + | 26 NormalizeLayoutTestURL(image_url.string().utf8()) + "): " + |
27 "): " + (allowed ? "true" : "false") + "\n"); | 27 (allowed ? "true" : "false") + "\n"); |
28 } | 28 } |
29 return allowed; | 29 return allowed; |
30 } | 30 } |
31 | 31 |
32 bool MockContentSettingsClient::allowScript(bool enabled_per_settings) { | 32 bool MockContentSettingsClient::allowScript(bool enabled_per_settings) { |
33 return enabled_per_settings && flags_->scripts_allowed(); | 33 return enabled_per_settings && flags_->scripts_allowed(); |
34 } | 34 } |
35 | 35 |
36 bool MockContentSettingsClient::allowScriptFromSource( | 36 bool MockContentSettingsClient::allowScriptFromSource( |
37 bool enabled_per_settings, | 37 bool enabled_per_settings, |
(...skipping 25 matching lines...) Expand all Loading... |
63 | 63 |
64 bool MockContentSettingsClient::allowAutoplay(bool default_value) { | 64 bool MockContentSettingsClient::allowAutoplay(bool default_value) { |
65 return flags_->autoplay_allowed(); | 65 return flags_->autoplay_allowed(); |
66 } | 66 } |
67 | 67 |
68 void MockContentSettingsClient::SetDelegate(WebTestDelegate* delegate) { | 68 void MockContentSettingsClient::SetDelegate(WebTestDelegate* delegate) { |
69 delegate_ = delegate; | 69 delegate_ = delegate; |
70 } | 70 } |
71 | 71 |
72 } // namespace test_runner | 72 } // namespace test_runner |
OLD | NEW |