Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: content/shell/renderer/test_runner/web_permissions.cc

Issue 583113002: Abstract class WebTestDelegate to chromium c++ style. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update test_runner Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/shell/renderer/test_runner/web_permissions.h" 5 #include "content/shell/renderer/test_runner/web_permissions.h"
6 6
7 #include "content/shell/renderer/test_runner/WebTestDelegate.h"
8 #include "content/shell/renderer/test_runner/test_common.h" 7 #include "content/shell/renderer/test_runner/test_common.h"
8 #include "content/shell/renderer/test_runner/web_test_delegate.h"
9 #include "third_party/WebKit/public/platform/WebCString.h" 9 #include "third_party/WebKit/public/platform/WebCString.h"
10 #include "third_party/WebKit/public/platform/WebURL.h" 10 #include "third_party/WebKit/public/platform/WebURL.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 WebPermissions::WebPermissions() : delegate_(0) { 14 WebPermissions::WebPermissions() : delegate_(0) {
15 Reset(); 15 Reset();
16 } 16 }
17 17
18 WebPermissions::~WebPermissions() {} 18 WebPermissions::~WebPermissions() {}
19 19
20 bool WebPermissions::allowImage(bool enabled_per_settings, 20 bool WebPermissions::allowImage(bool enabled_per_settings,
21 const blink::WebURL& image_url) { 21 const blink::WebURL& image_url) {
22 bool allowed = enabled_per_settings && images_allowed_; 22 bool allowed = enabled_per_settings && images_allowed_;
23 if (dump_callbacks_ && delegate_) { 23 if (dump_callbacks_ && delegate_) {
24 delegate_->printMessage(std::string("PERMISSION CLIENT: allowImage(") + 24 delegate_->PrintMessage(std::string("PERMISSION CLIENT: allowImage(") +
25 NormalizeLayoutTestURL(image_url.spec()) + "): " + 25 NormalizeLayoutTestURL(image_url.spec()) + "): " +
26 (allowed ? "true" : "false") + "\n"); 26 (allowed ? "true" : "false") + "\n");
27 } 27 }
28 return allowed; 28 return allowed;
29 } 29 }
30 30
31 bool WebPermissions::allowMedia(const blink::WebURL& image_url) { 31 bool WebPermissions::allowMedia(const blink::WebURL& image_url) {
32 bool allowed = media_allowed_; 32 bool allowed = media_allowed_;
33 if (dump_callbacks_ && delegate_) 33 if (dump_callbacks_ && delegate_)
34 delegate_->printMessage(std::string("PERMISSION CLIENT: allowMedia(") + 34 delegate_->PrintMessage(std::string("PERMISSION CLIENT: allowMedia(") +
35 NormalizeLayoutTestURL(image_url.spec()) + "): " + 35 NormalizeLayoutTestURL(image_url.spec()) + "): " +
36 (allowed ? "true" : "false") + "\n"); 36 (allowed ? "true" : "false") + "\n");
37 return allowed; 37 return allowed;
38 } 38 }
39 39
40 bool WebPermissions::allowScriptFromSource(bool enabled_per_settings, 40 bool WebPermissions::allowScriptFromSource(bool enabled_per_settings,
41 const blink::WebURL& scriptURL) { 41 const blink::WebURL& scriptURL) {
42 bool allowed = enabled_per_settings && scripts_allowed_; 42 bool allowed = enabled_per_settings && scripts_allowed_;
43 if (dump_callbacks_ && delegate_) { 43 if (dump_callbacks_ && delegate_) {
44 delegate_->printMessage( 44 delegate_->PrintMessage(
45 std::string("PERMISSION CLIENT: allowScriptFromSource(") + 45 std::string("PERMISSION CLIENT: allowScriptFromSource(") +
46 NormalizeLayoutTestURL(scriptURL.spec()) + "): " + 46 NormalizeLayoutTestURL(scriptURL.spec()) + "): " +
47 (allowed ? "true" : "false") + "\n"); 47 (allowed ? "true" : "false") + "\n");
48 } 48 }
49 return allowed; 49 return allowed;
50 } 50 }
51 51
52 bool WebPermissions::allowStorage(bool) { 52 bool WebPermissions::allowStorage(bool) {
53 return storage_allowed_; 53 return storage_allowed_;
54 } 54 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 images_allowed_ = true; 112 images_allowed_ = true;
113 media_allowed_ = true; 113 media_allowed_ = true;
114 scripts_allowed_ = true; 114 scripts_allowed_ = true;
115 storage_allowed_ = true; 115 storage_allowed_ = true;
116 plugins_allowed_ = true; 116 plugins_allowed_ = true;
117 displaying_insecure_content_allowed_ = false; 117 displaying_insecure_content_allowed_ = false;
118 running_insecure_content_allowed_ = false; 118 running_insecure_content_allowed_ = false;
119 } 119 }
120 120
121 } // namespace content 121 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/web_frame_test_proxy.h ('k') | content/shell/renderer/test_runner/web_test_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698