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/shell/common/test_runner/test_preferences.h" | 10 #include "content/shell/common/test_runner/test_preferences.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 void DidNotAcquirePointerLock(); | 177 void DidNotAcquirePointerLock(); |
178 void DidLosePointerLock(); | 178 void DidLosePointerLock(); |
179 void SetPointerLockWillFailSynchronously(); | 179 void SetPointerLockWillFailSynchronously(); |
180 void SetPointerLockWillRespondAsynchronously(); | 180 void SetPointerLockWillRespondAsynchronously(); |
181 void SetPopupBlockingEnabled(bool block_popups); | 181 void SetPopupBlockingEnabled(bool block_popups); |
182 void SetJavaScriptCanAccessClipboard(bool can_access); | 182 void SetJavaScriptCanAccessClipboard(bool can_access); |
183 void SetXSSAuditorEnabled(bool enabled); | 183 void SetXSSAuditorEnabled(bool enabled); |
184 void SetAllowUniversalAccessFromFileURLs(bool allow); | 184 void SetAllowUniversalAccessFromFileURLs(bool allow); |
185 void SetAllowFileAccessFromFileURLs(bool allow); | 185 void SetAllowFileAccessFromFileURLs(bool allow); |
186 void OverridePreference(const std::string key, v8::Handle<v8::Value> value); | 186 void OverridePreference(const std::string key, v8::Handle<v8::Value> value); |
187 void SetAcceptLanguages(const std::string& accept_languages); | |
188 void SetPluginsEnabled(bool enabled); | 187 void SetPluginsEnabled(bool enabled); |
189 void DumpEditingCallbacks(); | 188 void DumpEditingCallbacks(); |
190 void DumpAsText(); | 189 void DumpAsText(); |
191 void DumpAsTextWithPixelResults(); | 190 void DumpAsTextWithPixelResults(); |
192 void DumpChildFrameScrollPositions(); | 191 void DumpChildFrameScrollPositions(); |
193 void DumpChildFramesAsText(); | 192 void DumpChildFramesAsText(); |
194 void DumpIconChanges(); | 193 void DumpIconChanges(); |
195 void SetAudioData(const gin::ArrayBufferView& view); | 194 void SetAudioData(const gin::ArrayBufferView& view); |
196 void DumpFrameLoadCallbacks(); | 195 void DumpFrameLoadCallbacks(); |
197 void DumpPingLoaderCallbacks(); | 196 void DumpPingLoaderCallbacks(); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 &TestRunnerBindings::SetPopupBlockingEnabled) | 376 &TestRunnerBindings::SetPopupBlockingEnabled) |
378 .SetMethod("setJavaScriptCanAccessClipboard", | 377 .SetMethod("setJavaScriptCanAccessClipboard", |
379 &TestRunnerBindings::SetJavaScriptCanAccessClipboard) | 378 &TestRunnerBindings::SetJavaScriptCanAccessClipboard) |
380 .SetMethod("setXSSAuditorEnabled", | 379 .SetMethod("setXSSAuditorEnabled", |
381 &TestRunnerBindings::SetXSSAuditorEnabled) | 380 &TestRunnerBindings::SetXSSAuditorEnabled) |
382 .SetMethod("setAllowUniversalAccessFromFileURLs", | 381 .SetMethod("setAllowUniversalAccessFromFileURLs", |
383 &TestRunnerBindings::SetAllowUniversalAccessFromFileURLs) | 382 &TestRunnerBindings::SetAllowUniversalAccessFromFileURLs) |
384 .SetMethod("setAllowFileAccessFromFileURLs", | 383 .SetMethod("setAllowFileAccessFromFileURLs", |
385 &TestRunnerBindings::SetAllowFileAccessFromFileURLs) | 384 &TestRunnerBindings::SetAllowFileAccessFromFileURLs) |
386 .SetMethod("overridePreference", &TestRunnerBindings::OverridePreference) | 385 .SetMethod("overridePreference", &TestRunnerBindings::OverridePreference) |
387 .SetMethod("setAcceptLanguages", &TestRunnerBindings::SetAcceptLanguages) | |
388 .SetMethod("setPluginsEnabled", &TestRunnerBindings::SetPluginsEnabled) | 386 .SetMethod("setPluginsEnabled", &TestRunnerBindings::SetPluginsEnabled) |
389 .SetMethod("dumpEditingCallbacks", | 387 .SetMethod("dumpEditingCallbacks", |
390 &TestRunnerBindings::DumpEditingCallbacks) | 388 &TestRunnerBindings::DumpEditingCallbacks) |
391 .SetMethod("dumpAsText", &TestRunnerBindings::DumpAsText) | 389 .SetMethod("dumpAsText", &TestRunnerBindings::DumpAsText) |
392 .SetMethod("dumpAsTextWithPixelResults", | 390 .SetMethod("dumpAsTextWithPixelResults", |
393 &TestRunnerBindings::DumpAsTextWithPixelResults) | 391 &TestRunnerBindings::DumpAsTextWithPixelResults) |
394 .SetMethod("dumpChildFrameScrollPositions", | 392 .SetMethod("dumpChildFrameScrollPositions", |
395 &TestRunnerBindings::DumpChildFrameScrollPositions) | 393 &TestRunnerBindings::DumpChildFrameScrollPositions) |
396 .SetMethod("dumpChildFramesAsText", | 394 .SetMethod("dumpChildFramesAsText", |
397 &TestRunnerBindings::DumpChildFramesAsText) | 395 &TestRunnerBindings::DumpChildFramesAsText) |
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 if (runner_) | 913 if (runner_) |
916 runner_->SetAllowFileAccessFromFileURLs(allow); | 914 runner_->SetAllowFileAccessFromFileURLs(allow); |
917 } | 915 } |
918 | 916 |
919 void TestRunnerBindings::OverridePreference(const std::string key, | 917 void TestRunnerBindings::OverridePreference(const std::string key, |
920 v8::Handle<v8::Value> value) { | 918 v8::Handle<v8::Value> value) { |
921 if (runner_) | 919 if (runner_) |
922 runner_->OverridePreference(key, value); | 920 runner_->OverridePreference(key, value); |
923 } | 921 } |
924 | 922 |
925 void TestRunnerBindings::SetAcceptLanguages( | |
926 const std::string& accept_languages) { | |
927 if (!runner_) | |
928 return; | |
929 | |
930 runner_->SetAcceptLanguages(accept_languages); | |
931 } | |
932 | |
933 void TestRunnerBindings::SetPluginsEnabled(bool enabled) { | 923 void TestRunnerBindings::SetPluginsEnabled(bool enabled) { |
934 if (runner_) | 924 if (runner_) |
935 runner_->SetPluginsEnabled(enabled); | 925 runner_->SetPluginsEnabled(enabled); |
936 } | 926 } |
937 | 927 |
938 void TestRunnerBindings::DumpEditingCallbacks() { | 928 void TestRunnerBindings::DumpEditingCallbacks() { |
939 if (runner_) | 929 if (runner_) |
940 runner_->DumpEditingCallbacks(); | 930 runner_->DumpEditingCallbacks(); |
941 } | 931 } |
942 | 932 |
(...skipping 1382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2325 } else if (key == "WebKitWebAudioEnabled") { | 2315 } else if (key == "WebKitWebAudioEnabled") { |
2326 DCHECK(value->BooleanValue()); | 2316 DCHECK(value->BooleanValue()); |
2327 } else { | 2317 } else { |
2328 std::string message("Invalid name for preference: "); | 2318 std::string message("Invalid name for preference: "); |
2329 message.append(key); | 2319 message.append(key); |
2330 delegate_->printMessage(std::string("CONSOLE MESSAGE: ") + message + "\n"); | 2320 delegate_->printMessage(std::string("CONSOLE MESSAGE: ") + message + "\n"); |
2331 } | 2321 } |
2332 delegate_->applyPreferences(); | 2322 delegate_->applyPreferences(); |
2333 } | 2323 } |
2334 | 2324 |
2335 void TestRunner::SetAcceptLanguages(const std::string& accept_languages) { | |
2336 proxy_->SetAcceptLanguages(accept_languages); | |
2337 } | |
2338 | |
2339 void TestRunner::SetPluginsEnabled(bool enabled) { | 2325 void TestRunner::SetPluginsEnabled(bool enabled) { |
2340 delegate_->preferences()->plugins_enabled = enabled; | 2326 delegate_->preferences()->plugins_enabled = enabled; |
2341 delegate_->applyPreferences(); | 2327 delegate_->applyPreferences(); |
2342 } | 2328 } |
2343 | 2329 |
2344 void TestRunner::DumpEditingCallbacks() { | 2330 void TestRunner::DumpEditingCallbacks() { |
2345 dump_editting_callbacks_ = true; | 2331 dump_editting_callbacks_ = true; |
2346 } | 2332 } |
2347 | 2333 |
2348 void TestRunner::DumpAsText() { | 2334 void TestRunner::DumpAsText() { |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2647 } | 2633 } |
2648 | 2634 |
2649 void TestRunner::DidLosePointerLockInternal() { | 2635 void TestRunner::DidLosePointerLockInternal() { |
2650 bool was_locked = pointer_locked_; | 2636 bool was_locked = pointer_locked_; |
2651 pointer_locked_ = false; | 2637 pointer_locked_ = false; |
2652 if (was_locked) | 2638 if (was_locked) |
2653 web_view_->didLosePointerLock(); | 2639 web_view_->didLosePointerLock(); |
2654 } | 2640 } |
2655 | 2641 |
2656 } // namespace content | 2642 } // namespace content |
OLD | NEW |