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

Side by Side Diff: components/html_viewer/html_frame_apptest.cc

Issue 1681813002: Rename Connection::AddService/ConnectToService to Connection::AddInterface/GetInterface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@interface_binder
Patch Set: . Created 4 years, 10 months 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 *got_callback = true; 51 *got_callback = true;
52 ignore_result(WindowServerTestBase::QuitRunLoop()); 52 ignore_result(WindowServerTestBase::QuitRunLoop());
53 } 53 }
54 54
55 mojo::Connection* ConnectionForFrame(Frame* frame) { 55 mojo::Connection* ConnectionForFrame(Frame* frame) {
56 return static_cast<FrameConnection*>(frame->user_data())->connection(); 56 return static_cast<FrameConnection*>(frame->user_data())->connection();
57 } 57 }
58 58
59 std::string GetFrameText(Connection* connection) { 59 std::string GetFrameText(Connection* connection) {
60 html_viewer::TestHTMLViewerPtr test_html_viewer; 60 html_viewer::TestHTMLViewerPtr test_html_viewer;
61 connection->ConnectToService(&test_html_viewer); 61 connection->GetInterface(&test_html_viewer);
62 std::string result; 62 std::string result;
63 test_html_viewer->GetContentAsText([&result](const String& mojo_string) { 63 test_html_viewer->GetContentAsText([&result](const String& mojo_string) {
64 result = mojo_string; 64 result = mojo_string;
65 ASSERT_TRUE(WindowServerTestBase::QuitRunLoop()); 65 ASSERT_TRUE(WindowServerTestBase::QuitRunLoop());
66 }); 66 });
67 if (!WindowServerTestBase::DoRunLoopWithTimeout()) 67 if (!WindowServerTestBase::DoRunLoopWithTimeout())
68 ADD_FAILURE() << "Timed out waiting for execute to complete"; 68 ADD_FAILURE() << "Timed out waiting for execute to complete";
69 // test_html_viewer.WaitForIncomingResponse(); 69 // test_html_viewer.WaitForIncomingResponse();
70 return result; 70 return result;
71 } 71 }
72 72
73 scoped_ptr<base::Value> ExecuteScript(Connection* connection, 73 scoped_ptr<base::Value> ExecuteScript(Connection* connection,
74 const std::string& script) { 74 const std::string& script) {
75 html_viewer::TestHTMLViewerPtr test_html_viewer; 75 html_viewer::TestHTMLViewerPtr test_html_viewer;
76 connection->ConnectToService(&test_html_viewer); 76 connection->GetInterface(&test_html_viewer);
77 scoped_ptr<base::Value> result; 77 scoped_ptr<base::Value> result;
78 test_html_viewer->ExecuteScript(script, [&result](const String& json_string) { 78 test_html_viewer->ExecuteScript(script, [&result](const String& json_string) {
79 result = base::JSONReader::Read(json_string.To<std::string>()); 79 result = base::JSONReader::Read(json_string.To<std::string>());
80 ASSERT_TRUE(WindowServerTestBase::QuitRunLoop()); 80 ASSERT_TRUE(WindowServerTestBase::QuitRunLoop());
81 }); 81 });
82 if (!WindowServerTestBase::DoRunLoopWithTimeout()) 82 if (!WindowServerTestBase::DoRunLoopWithTimeout())
83 ADD_FAILURE() << "Timed out waiting for execute to complete"; 83 ADD_FAILURE() << "Timed out waiting for execute to complete";
84 return result; 84 return result;
85 } 85 }
86 86
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 script_value_as_list->GetString(0u, &message_in_child); 483 script_value_as_list->GetString(0u, &message_in_child);
484 } 484 }
485 } 485 }
486 } while (message_in_child != "hello from parent" && 486 } while (message_in_child != "hello from parent" &&
487 base::TimeTicks::Now() - start_time < 487 base::TimeTicks::Now() - start_time <
488 TestTimeouts::action_timeout()); 488 TestTimeouts::action_timeout());
489 EXPECT_EQ("hello from parent", message_in_child); 489 EXPECT_EQ("hello from parent", message_in_child);
490 } 490 }
491 491
492 } // namespace mojo 492 } // namespace mojo
OLDNEW
« no previous file with comments | « components/html_viewer/html_document_application_delegate.cc ('k') | components/html_viewer/html_viewer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698