| 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 "sky/viewer/internals.h" | 5 #include "sky/viewer/internals.h" |
| 6 | 6 |
| 7 #include "mojo/edk/js/core.h" | 7 #include "mojo/edk/js/core.h" |
| 8 #include "mojo/edk/js/handle.h" | 8 #include "mojo/edk/js/handle.h" |
| 9 #include "mojo/edk/js/support.h" | 9 #include "mojo/edk/js/support.h" |
| 10 #include "mojo/public/cpp/application/connect.h" | 10 #include "mojo/public/cpp/application/connect.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 | 59 |
| 60 std::string Internals::ContentAsText() { | 60 std::string Internals::ContentAsText() { |
| 61 if (!document_view_) | 61 if (!document_view_) |
| 62 return std::string(); | 62 return std::string(); |
| 63 return document_view_->web_view()->mainFrame()->contentAsText( | 63 return document_view_->web_view()->mainFrame()->contentAsText( |
| 64 1024*1024).utf8(); | 64 1024*1024).utf8(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void Internals::NotifyTestComplete(const std::string& test_result) { | 67 void Internals::NotifyTestComplete(const std::string& test_result) { |
| 68 test_harness_->OnTestComplete(test_result); | 68 test_harness_->OnTestComplete(test_result, document_view_->GetPixels()); |
| 69 } | 69 } |
| 70 | 70 |
| 71 mojo::Handle Internals::ConnectToService( | 71 mojo::Handle Internals::ConnectToService( |
| 72 const std::string& application_url, const std::string& interface_name) { | 72 const std::string& application_url, const std::string& interface_name) { |
| 73 if (!document_view_) | 73 if (!document_view_) |
| 74 return mojo::Handle(); | 74 return mojo::Handle(); |
| 75 | 75 |
| 76 mojo::ServiceProviderPtr service_provider; | 76 mojo::ServiceProviderPtr service_provider; |
| 77 document_view_->shell()->ConnectToApplication( | 77 document_view_->shell()->ConnectToApplication( |
| 78 application_url, mojo::GetProxy(&service_provider)); | 78 application_url, mojo::GetProxy(&service_provider)); |
| 79 | 79 |
| 80 mojo::MessagePipe pipe; | 80 mojo::MessagePipe pipe; |
| 81 service_provider->ConnectToService(interface_name, pipe.handle1.Pass()); | 81 service_provider->ConnectToService(interface_name, pipe.handle1.Pass()); |
| 82 return pipe.handle0.release(); | 82 return pipe.handle0.release(); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void Internals::pauseAnimations(double pauseTime) { | 85 void Internals::pauseAnimations(double pauseTime) { |
| 86 if (pauseTime < 0) | 86 if (pauseTime < 0) |
| 87 return; | 87 return; |
| 88 | 88 |
| 89 document_view_->web_view()->mainFrame()->document().pauseAnimationsForTestin
g(pauseTime); | 89 document_view_->web_view()->mainFrame()->document().pauseAnimationsForTestin
g(pauseTime); |
| 90 } | 90 } |
| 91 | 91 |
| 92 } // namespace sky | 92 } // namespace sky |
| OLD | NEW |