Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(349)

Side by Side Diff: sky/viewer/internals.cc

Issue 797063002: Make reftests work for sky. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: cleanup Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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,
69 document_view_->GetPixelsForTesting());
69 } 70 }
70 71
71 mojo::Handle Internals::ConnectToService( 72 mojo::Handle Internals::ConnectToService(
72 const std::string& application_url, const std::string& interface_name) { 73 const std::string& application_url, const std::string& interface_name) {
73 if (!document_view_) 74 if (!document_view_)
74 return mojo::Handle(); 75 return mojo::Handle();
75 76
76 mojo::ServiceProviderPtr service_provider; 77 mojo::ServiceProviderPtr service_provider;
77 document_view_->shell()->ConnectToApplication( 78 document_view_->shell()->ConnectToApplication(
78 application_url, mojo::GetProxy(&service_provider)); 79 application_url, mojo::GetProxy(&service_provider));
79 80
80 mojo::MessagePipe pipe; 81 mojo::MessagePipe pipe;
81 service_provider->ConnectToService(interface_name, pipe.handle1.Pass()); 82 service_provider->ConnectToService(interface_name, pipe.handle1.Pass());
82 return pipe.handle0.release(); 83 return pipe.handle0.release();
83 } 84 }
84 85
85 void Internals::pauseAnimations(double pauseTime) { 86 void Internals::pauseAnimations(double pauseTime) {
86 if (pauseTime < 0) 87 if (pauseTime < 0)
87 return; 88 return;
88 89
89 document_view_->web_view()->mainFrame()->document().pauseAnimationsForTestin g(pauseTime); 90 document_view_->web_view()->mainFrame()->document().pauseAnimationsForTestin g(pauseTime);
90 } 91 }
91 92
92 } // namespace sky 93 } // namespace sky
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698