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

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

Issue 715123002: Rename sky::TestObserver to sky::TestHarness (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « sky/viewer/internals.h ('k') | sky/viewer/services/test_harness.mojom » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 16 matching lines...) Expand all
27 v8::Handle<v8::Object> object = internals.ToV8().As<v8::Object>(); 27 v8::Handle<v8::Object> object = internals.ToV8().As<v8::Object>();
28 object->Set(gin::StringToV8(isolate, "core"), 28 object->Set(gin::StringToV8(isolate, "core"),
29 mojo::js::Core::GetModule(isolate)); 29 mojo::js::Core::GetModule(isolate));
30 object->Set(gin::StringToV8(isolate, "support"), 30 object->Set(gin::StringToV8(isolate, "support"),
31 mojo::js::Support::GetModule(isolate)); 31 mojo::js::Support::GetModule(isolate));
32 return internals; 32 return internals;
33 } 33 }
34 34
35 Internals::Internals(DocumentView* document_view) 35 Internals::Internals(DocumentView* document_view)
36 : document_view_(document_view->GetWeakPtr()) { 36 : document_view_(document_view->GetWeakPtr()) {
37 mojo::ConnectToService(document_view->imported_services(), &test_observer_); 37 mojo::ConnectToService(document_view->imported_services(), &test_harness_);
38 } 38 }
39 39
40 Internals::~Internals() { 40 Internals::~Internals() {
41 } 41 }
42 42
43 gin::ObjectTemplateBuilder Internals::GetObjectTemplateBuilder( 43 gin::ObjectTemplateBuilder Internals::GetObjectTemplateBuilder(
44 v8::Isolate* isolate) { 44 v8::Isolate* isolate) {
45 return Wrappable<Internals>::GetObjectTemplateBuilder(isolate) 45 return Wrappable<Internals>::GetObjectTemplateBuilder(isolate)
46 .SetMethod("renderTreeAsText", &Internals::RenderTreeAsText) 46 .SetMethod("renderTreeAsText", &Internals::RenderTreeAsText)
47 .SetMethod("contentAsText", &Internals::ContentAsText) 47 .SetMethod("contentAsText", &Internals::ContentAsText)
(...skipping 15 matching lines...) Expand all
63 1024*1024).utf8(); 63 1024*1024).utf8();
64 } 64 }
65 65
66 std::string Internals::ContentAsMarkup() { 66 std::string Internals::ContentAsMarkup() {
67 if (!document_view_) 67 if (!document_view_)
68 return std::string(); 68 return std::string();
69 return document_view_->web_view()->mainFrame()->contentAsMarkup().utf8(); 69 return document_view_->web_view()->mainFrame()->contentAsMarkup().utf8();
70 } 70 }
71 71
72 void Internals::NotifyTestComplete(const std::string& test_result) { 72 void Internals::NotifyTestComplete(const std::string& test_result) {
73 test_observer_->OnTestComplete(test_result); 73 test_harness_->OnTestComplete(test_result);
74 } 74 }
75 75
76 mojo::Handle Internals::ConnectToService( 76 mojo::Handle Internals::ConnectToService(
77 const std::string& application_url, const std::string& interface_name) { 77 const std::string& application_url, const std::string& interface_name) {
78 if (!document_view_) 78 if (!document_view_)
79 return mojo::Handle(); 79 return mojo::Handle();
80 80
81 mojo::ServiceProviderPtr service_provider; 81 mojo::ServiceProviderPtr service_provider;
82 document_view_->shell()->ConnectToApplication( 82 document_view_->shell()->ConnectToApplication(
83 application_url, mojo::GetProxy(&service_provider)); 83 application_url, mojo::GetProxy(&service_provider));
84 84
85 mojo::MessagePipe pipe; 85 mojo::MessagePipe pipe;
86 service_provider->ConnectToService(interface_name, pipe.handle1.Pass()); 86 service_provider->ConnectToService(interface_name, pipe.handle1.Pass());
87 return pipe.handle0.release(); 87 return pipe.handle0.release();
88 } 88 }
89 89
90 } // namespace sky 90 } // namespace sky
OLDNEW
« no previous file with comments | « sky/viewer/internals.h ('k') | sky/viewer/services/test_harness.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698