| 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 "content/shell/renderer/test_runner/test_runner.h" | 5 #include "content/shell/renderer/test_runner/test_runner.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/public/test/layouttest_support.h" | 10 #include "content/public/test/layouttest_support.h" |
| (...skipping 2142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2153 } | 2153 } |
| 2154 | 2154 |
| 2155 void TestRunner::SetIsolatedWorldSecurityOrigin(int world_id, | 2155 void TestRunner::SetIsolatedWorldSecurityOrigin(int world_id, |
| 2156 v8::Handle<v8::Value> origin) { | 2156 v8::Handle<v8::Value> origin) { |
| 2157 if (!(origin->IsString() || !origin->IsNull())) | 2157 if (!(origin->IsString() || !origin->IsNull())) |
| 2158 return; | 2158 return; |
| 2159 | 2159 |
| 2160 WebSecurityOrigin web_origin; | 2160 WebSecurityOrigin web_origin; |
| 2161 if (origin->IsString()) { | 2161 if (origin->IsString()) { |
| 2162 web_origin = WebSecurityOrigin::createFromString( | 2162 web_origin = WebSecurityOrigin::createFromString( |
| 2163 V8StringToWebString(origin->ToString())); | 2163 V8StringToWebString(origin.As<v8::String>())); |
| 2164 } | 2164 } |
| 2165 web_view_->focusedFrame()->setIsolatedWorldSecurityOrigin(world_id, | 2165 web_view_->focusedFrame()->setIsolatedWorldSecurityOrigin(world_id, |
| 2166 web_origin); | 2166 web_origin); |
| 2167 } | 2167 } |
| 2168 | 2168 |
| 2169 void TestRunner::SetIsolatedWorldContentSecurityPolicy( | 2169 void TestRunner::SetIsolatedWorldContentSecurityPolicy( |
| 2170 int world_id, | 2170 int world_id, |
| 2171 const std::string& policy) { | 2171 const std::string& policy) { |
| 2172 web_view_->focusedFrame()->setIsolatedWorldContentSecurityPolicy( | 2172 web_view_->focusedFrame()->setIsolatedWorldContentSecurityPolicy( |
| 2173 world_id, WebString::fromUTF8(policy)); | 2173 world_id, WebString::fromUTF8(policy)); |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2472 } | 2472 } |
| 2473 | 2473 |
| 2474 void TestRunner::OverridePreference(const std::string key, | 2474 void TestRunner::OverridePreference(const std::string key, |
| 2475 v8::Handle<v8::Value> value) { | 2475 v8::Handle<v8::Value> value) { |
| 2476 TestPreferences* prefs = delegate_->Preferences(); | 2476 TestPreferences* prefs = delegate_->Preferences(); |
| 2477 if (key == "WebKitDefaultFontSize") { | 2477 if (key == "WebKitDefaultFontSize") { |
| 2478 prefs->default_font_size = value->Int32Value(); | 2478 prefs->default_font_size = value->Int32Value(); |
| 2479 } else if (key == "WebKitMinimumFontSize") { | 2479 } else if (key == "WebKitMinimumFontSize") { |
| 2480 prefs->minimum_font_size = value->Int32Value(); | 2480 prefs->minimum_font_size = value->Int32Value(); |
| 2481 } else if (key == "WebKitDefaultTextEncodingName") { | 2481 } else if (key == "WebKitDefaultTextEncodingName") { |
| 2482 prefs->default_text_encoding_name = V8StringToWebString(value->ToString()); | 2482 v8::Isolate* isolate = blink::mainThreadIsolate(); |
| 2483 prefs->default_text_encoding_name = |
| 2484 V8StringToWebString(value->ToString(isolate)); |
| 2483 } else if (key == "WebKitJavaScriptEnabled") { | 2485 } else if (key == "WebKitJavaScriptEnabled") { |
| 2484 prefs->java_script_enabled = value->BooleanValue(); | 2486 prefs->java_script_enabled = value->BooleanValue(); |
| 2485 } else if (key == "WebKitSupportsMultipleWindows") { | 2487 } else if (key == "WebKitSupportsMultipleWindows") { |
| 2486 prefs->supports_multiple_windows = value->BooleanValue(); | 2488 prefs->supports_multiple_windows = value->BooleanValue(); |
| 2487 } else if (key == "WebKitDisplayImagesKey") { | 2489 } else if (key == "WebKitDisplayImagesKey") { |
| 2488 prefs->loads_images_automatically = value->BooleanValue(); | 2490 prefs->loads_images_automatically = value->BooleanValue(); |
| 2489 } else if (key == "WebKitPluginsEnabled") { | 2491 } else if (key == "WebKitPluginsEnabled") { |
| 2490 prefs->plugins_enabled = value->BooleanValue(); | 2492 prefs->plugins_enabled = value->BooleanValue(); |
| 2491 } else if (key == "WebKitJavaEnabled") { | 2493 } else if (key == "WebKitJavaEnabled") { |
| 2492 prefs->java_enabled = value->BooleanValue(); | 2494 prefs->java_enabled = value->BooleanValue(); |
| (...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2963 } | 2965 } |
| 2964 | 2966 |
| 2965 void TestRunner::DidLosePointerLockInternal() { | 2967 void TestRunner::DidLosePointerLockInternal() { |
| 2966 bool was_locked = pointer_locked_; | 2968 bool was_locked = pointer_locked_; |
| 2967 pointer_locked_ = false; | 2969 pointer_locked_ = false; |
| 2968 if (was_locked) | 2970 if (was_locked) |
| 2969 web_view_->didLosePointerLock(); | 2971 web_view_->didLosePointerLock(); |
| 2970 } | 2972 } |
| 2971 | 2973 |
| 2972 } // namespace content | 2974 } // namespace content |
| OLD | NEW |