| 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/test_runner.h" | 5 #include "components/test_runner/test_runner.h" | 
| 6 | 6 | 
| 7 #include <stddef.h> | 7 #include <stddef.h> | 
| 8 #include <limits> | 8 #include <limits> | 
| 9 #include <utility> | 9 #include <utility> | 
| 10 | 10 | 
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 259   void UseUnfortunateSynchronousResizeMode(); | 259   void UseUnfortunateSynchronousResizeMode(); | 
| 260   void WaitForPolicyDelegate(); | 260   void WaitForPolicyDelegate(); | 
| 261   void WaitUntilDone(); | 261   void WaitUntilDone(); | 
| 262   void WaitUntilExternalURLLoad(); | 262   void WaitUntilExternalURLLoad(); | 
| 263   void SetMockCredentialManagerError(const std::string& error); | 263   void SetMockCredentialManagerError(const std::string& error); | 
| 264   void SetMockCredentialManagerResponse(const std::string& id, | 264   void SetMockCredentialManagerResponse(const std::string& id, | 
| 265                                         const std::string& name, | 265                                         const std::string& name, | 
| 266                                         const std::string& avatar, | 266                                         const std::string& avatar, | 
| 267                                         const std::string& password); | 267                                         const std::string& password); | 
| 268   void ClearMockCredentialManagerResponse(); | 268   void ClearMockCredentialManagerResponse(); | 
| 269   bool AnimationScheduled(); |  | 
| 270   bool CallShouldCloseOnWebView(); | 269   bool CallShouldCloseOnWebView(); | 
| 271   bool DisableAutoResizeMode(int new_width, int new_height); | 270   bool DisableAutoResizeMode(int new_width, int new_height); | 
| 272   bool EnableAutoResizeMode(int min_width, | 271   bool EnableAutoResizeMode(int min_width, | 
| 273                             int min_height, | 272                             int min_height, | 
| 274                             int max_width, | 273                             int max_width, | 
| 275                             int max_height); | 274                             int max_height); | 
| 276   std::string EvaluateInWebInspectorOverlay(const std::string& script); | 275   std::string EvaluateInWebInspectorOverlay(const std::string& script); | 
| 277   v8::Local<v8::Value> EvaluateScriptInIsolatedWorldAndReturnValue( | 276   v8::Local<v8::Value> EvaluateScriptInIsolatedWorldAndReturnValue( | 
| 278       int world_id, const std::string& script); | 277       int world_id, const std::string& script); | 
| 279   bool FindString(const std::string& search_text, | 278   bool FindString(const std::string& search_text, | 
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 344                  &TestRunnerBindings::SetMockCredentialManagerError) | 343                  &TestRunnerBindings::SetMockCredentialManagerError) | 
| 345       .SetMethod("setMockCredentialManagerResponse", | 344       .SetMethod("setMockCredentialManagerResponse", | 
| 346                  &TestRunnerBindings::SetMockCredentialManagerResponse) | 345                  &TestRunnerBindings::SetMockCredentialManagerResponse) | 
| 347       .SetMethod("clearMockCredentialManagerResponse", | 346       .SetMethod("clearMockCredentialManagerResponse", | 
| 348                  &TestRunnerBindings::ClearMockCredentialManagerResponse) | 347                  &TestRunnerBindings::ClearMockCredentialManagerResponse) | 
| 349       .SetMethod("addMockSpeechRecognitionResult", | 348       .SetMethod("addMockSpeechRecognitionResult", | 
| 350                  &TestRunnerBindings::AddMockSpeechRecognitionResult) | 349                  &TestRunnerBindings::AddMockSpeechRecognitionResult) | 
| 351       .SetMethod("addOriginAccessWhitelistEntry", | 350       .SetMethod("addOriginAccessWhitelistEntry", | 
| 352                  &TestRunnerBindings::AddOriginAccessWhitelistEntry) | 351                  &TestRunnerBindings::AddOriginAccessWhitelistEntry) | 
| 353       .SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay) | 352       .SetMethod("addWebPageOverlay", &TestRunnerBindings::AddWebPageOverlay) | 
| 354       .SetMethod("animationScheduled", &TestRunnerBindings::AnimationScheduled) |  | 
| 355       .SetMethod("callShouldCloseOnWebView", | 353       .SetMethod("callShouldCloseOnWebView", | 
| 356                  &TestRunnerBindings::CallShouldCloseOnWebView) | 354                  &TestRunnerBindings::CallShouldCloseOnWebView) | 
| 357       .SetMethod("capturePixelsAsyncThen", | 355       .SetMethod("capturePixelsAsyncThen", | 
| 358                  &TestRunnerBindings::CapturePixelsAsyncThen) | 356                  &TestRunnerBindings::CapturePixelsAsyncThen) | 
| 359       .SetMethod("clearAllDatabases", &TestRunnerBindings::ClearAllDatabases) | 357       .SetMethod("clearAllDatabases", &TestRunnerBindings::ClearAllDatabases) | 
| 360       .SetMethod("clearBackForwardList", &TestRunnerBindings::NotImplemented) | 358       .SetMethod("clearBackForwardList", &TestRunnerBindings::NotImplemented) | 
| 361       .SetMethod("clearPrinting", &TestRunnerBindings::ClearPrinting) | 359       .SetMethod("clearPrinting", &TestRunnerBindings::ClearPrinting) | 
| 362       .SetMethod("closeWebInspector", &TestRunnerBindings::CloseWebInspector) | 360       .SetMethod("closeWebInspector", &TestRunnerBindings::CloseWebInspector) | 
| 363       .SetMethod("copyImageAtAndCapturePixelsAsyncThen", | 361       .SetMethod("copyImageAtAndCapturePixelsAsyncThen", | 
| 364                  &TestRunnerBindings::CopyImageAtAndCapturePixelsAsyncThen) | 362                  &TestRunnerBindings::CopyImageAtAndCapturePixelsAsyncThen) | 
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1050     return; | 1048     return; | 
| 1051 | 1049 | 
| 1052   runner_->SetAcceptLanguages(accept_languages); | 1050   runner_->SetAcceptLanguages(accept_languages); | 
| 1053 } | 1051 } | 
| 1054 | 1052 | 
| 1055 void TestRunnerBindings::SetPluginsEnabled(bool enabled) { | 1053 void TestRunnerBindings::SetPluginsEnabled(bool enabled) { | 
| 1056   if (runner_) | 1054   if (runner_) | 
| 1057     runner_->SetPluginsEnabled(enabled); | 1055     runner_->SetPluginsEnabled(enabled); | 
| 1058 } | 1056 } | 
| 1059 | 1057 | 
| 1060 bool TestRunnerBindings::AnimationScheduled() { |  | 
| 1061   if (runner_) |  | 
| 1062     return runner_->GetAnimationScheduled(); |  | 
| 1063   else |  | 
| 1064     return false; |  | 
| 1065 } |  | 
| 1066 |  | 
| 1067 void TestRunnerBindings::DumpEditingCallbacks() { | 1058 void TestRunnerBindings::DumpEditingCallbacks() { | 
| 1068   if (runner_) | 1059   if (runner_) | 
| 1069     runner_->DumpEditingCallbacks(); | 1060     runner_->DumpEditingCallbacks(); | 
| 1070 } | 1061 } | 
| 1071 | 1062 | 
| 1072 void TestRunnerBindings::DumpAsMarkup() { | 1063 void TestRunnerBindings::DumpAsMarkup() { | 
| 1073   if (runner_) | 1064   if (runner_) | 
| 1074     runner_->DumpAsMarkup(); | 1065     runner_->DumpAsMarkup(); | 
| 1075 } | 1066 } | 
| 1076 | 1067 | 
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1637   main_view_ = web_view; | 1628   main_view_ = web_view; | 
| 1638 } | 1629 } | 
| 1639 | 1630 | 
| 1640 void TestRunner::Reset() { | 1631 void TestRunner::Reset() { | 
| 1641   is_web_platform_tests_mode_ = false; | 1632   is_web_platform_tests_mode_ = false; | 
| 1642   will_navigate_ = false; | 1633   will_navigate_ = false; | 
| 1643   top_loading_frame_ = nullptr; | 1634   top_loading_frame_ = nullptr; | 
| 1644   layout_test_runtime_flags_.Reset(); | 1635   layout_test_runtime_flags_.Reset(); | 
| 1645   mock_screen_orientation_client_->ResetData(); | 1636   mock_screen_orientation_client_->ResetData(); | 
| 1646   drag_image_.reset(); | 1637   drag_image_.reset(); | 
| 1647   widgets_with_scheduled_animations_.clear(); |  | 
| 1648 | 1638 | 
| 1649   WebSecurityPolicy::resetOriginAccessWhitelists(); | 1639   WebSecurityPolicy::resetOriginAccessWhitelists(); | 
| 1650 #if defined(__linux__) || defined(ANDROID) | 1640 #if defined(__linux__) || defined(ANDROID) | 
| 1651   WebFontRendering::setSubpixelPositioning(false); | 1641   WebFontRendering::setSubpixelPositioning(false); | 
| 1652 #endif | 1642 #endif | 
| 1653 | 1643 | 
| 1654   if (delegate_) { | 1644   if (delegate_) { | 
| 1655     // Reset the default quota for each origin to 5MB | 1645     // Reset the default quota for each origin to 5MB | 
| 1656     delegate_->SetDatabaseQuota(5 * 1024 * 1024); | 1646     delegate_->SetDatabaseQuota(5 * 1024 * 1024); | 
| 1657     delegate_->SetDeviceColorProfile("reset"); | 1647     delegate_->SetDeviceColorProfile("reset"); | 
| (...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2400 | 2390 | 
| 2401   for (WebViewTestProxyBase* window : test_interfaces_->GetWindowList()) | 2391   for (WebViewTestProxyBase* window : test_interfaces_->GetWindowList()) | 
| 2402     window->web_view()->acceptLanguagesChanged(); | 2392     window->web_view()->acceptLanguagesChanged(); | 
| 2403 } | 2393 } | 
| 2404 | 2394 | 
| 2405 void TestRunner::SetPluginsEnabled(bool enabled) { | 2395 void TestRunner::SetPluginsEnabled(bool enabled) { | 
| 2406   delegate_->Preferences()->plugins_enabled = enabled; | 2396   delegate_->Preferences()->plugins_enabled = enabled; | 
| 2407   delegate_->ApplyPreferences(); | 2397   delegate_->ApplyPreferences(); | 
| 2408 } | 2398 } | 
| 2409 | 2399 | 
| 2410 bool TestRunner::GetAnimationScheduled() const { |  | 
| 2411   bool is_animation_scheduled = !widgets_with_scheduled_animations_.empty(); |  | 
| 2412   return is_animation_scheduled; |  | 
| 2413 } |  | 
| 2414 |  | 
| 2415 void TestRunner::OnAnimationScheduled(blink::WebWidget* widget) { |  | 
| 2416   widgets_with_scheduled_animations_.insert(widget); |  | 
| 2417 } |  | 
| 2418 |  | 
| 2419 void TestRunner::OnAnimationBegun(blink::WebWidget* widget) { |  | 
| 2420   widgets_with_scheduled_animations_.erase(widget); |  | 
| 2421 } |  | 
| 2422 |  | 
| 2423 void TestRunner::DumpEditingCallbacks() { | 2400 void TestRunner::DumpEditingCallbacks() { | 
| 2424   layout_test_runtime_flags_.set_dump_editting_callbacks(true); | 2401   layout_test_runtime_flags_.set_dump_editting_callbacks(true); | 
| 2425   OnLayoutTestRuntimeFlagsChanged(); | 2402   OnLayoutTestRuntimeFlagsChanged(); | 
| 2426 } | 2403 } | 
| 2427 | 2404 | 
| 2428 void TestRunner::DumpAsMarkup() { | 2405 void TestRunner::DumpAsMarkup() { | 
| 2429   layout_test_runtime_flags_.set_dump_as_markup(true); | 2406   layout_test_runtime_flags_.set_dump_as_markup(true); | 
| 2430   layout_test_runtime_flags_.set_generate_pixel_results(false); | 2407   layout_test_runtime_flags_.set_generate_pixel_results(false); | 
| 2431   OnLayoutTestRuntimeFlagsChanged(); | 2408   OnLayoutTestRuntimeFlagsChanged(); | 
| 2432 } | 2409 } | 
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2803 | 2780 | 
| 2804 void TestRunner::NotifyDone() { | 2781 void TestRunner::NotifyDone() { | 
| 2805   if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && | 2782   if (layout_test_runtime_flags_.wait_until_done() && !topLoadingFrame() && | 
| 2806       !will_navigate_ && work_queue_.is_empty()) | 2783       !will_navigate_ && work_queue_.is_empty()) | 
| 2807     delegate_->TestFinished(); | 2784     delegate_->TestFinished(); | 
| 2808   layout_test_runtime_flags_.set_wait_until_done(false); | 2785   layout_test_runtime_flags_.set_wait_until_done(false); | 
| 2809   OnLayoutTestRuntimeFlagsChanged(); | 2786   OnLayoutTestRuntimeFlagsChanged(); | 
| 2810 } | 2787 } | 
| 2811 | 2788 | 
| 2812 }  // namespace test_runner | 2789 }  // namespace test_runner | 
| OLD | NEW | 
|---|