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