OLD | NEW |
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 "base/auto_reset.h" | 5 #include "base/auto_reset.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 base::AutoReset<bool> resetter(&waiting_for_navigate_, true); | 99 base::AutoReset<bool> resetter(&waiting_for_navigate_, true); |
100 return ViewManagerTestBase::DoRunLoopWithTimeout() && got_navigate_; | 100 return ViewManagerTestBase::DoRunLoopWithTimeout() && got_navigate_; |
101 } | 101 } |
102 | 102 |
103 // TestFrameTreeDelegate: | 103 // TestFrameTreeDelegate: |
104 bool CanNavigateFrame( | 104 bool CanNavigateFrame( |
105 Frame* target, | 105 Frame* target, |
106 mojo::URLRequestPtr request, | 106 mojo::URLRequestPtr request, |
107 mandoline::FrameTreeClient** frame_tree_client, | 107 mandoline::FrameTreeClient** frame_tree_client, |
108 scoped_ptr<mandoline::FrameUserData>* frame_user_data, | 108 scoped_ptr<mandoline::FrameUserData>* frame_user_data, |
109 mojo::ViewManagerClientPtr* view_manager_client) override { | 109 mojo::ViewTreeClientPtr* tree_client) override { |
110 scoped_ptr<FrameConnection> frame_connection(new FrameConnection); | 110 scoped_ptr<FrameConnection> frame_connection(new FrameConnection); |
111 frame_connection->Init(app_, request.Pass(), view_manager_client); | 111 frame_connection->Init(app_, request.Pass(), tree_client); |
112 *frame_tree_client = frame_connection->frame_tree_client(); | 112 *frame_tree_client = frame_connection->frame_tree_client(); |
113 *frame_user_data = frame_connection.Pass(); | 113 *frame_user_data = frame_connection.Pass(); |
114 | 114 |
115 return true; | 115 return true; |
116 } | 116 } |
117 | 117 |
118 void DidStartNavigation(Frame* frame) override { | 118 void DidStartNavigation(Frame* frame) override { |
119 got_navigate_ = true; | 119 got_navigate_ = true; |
120 | 120 |
121 if (waiting_for_navigate_) | 121 if (waiting_for_navigate_) |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 189 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
190 request->url = mojo::String::From(AddPortToString(url_string)); | 190 request->url = mojo::String::From(AddPortToString(url_string)); |
191 return request.Pass(); | 191 return request.Pass(); |
192 } | 192 } |
193 | 193 |
194 FrameConnection* InitFrameTree(View* view, const std::string& url_string) { | 194 FrameConnection* InitFrameTree(View* view, const std::string& url_string) { |
195 frame_tree_delegate_.reset( | 195 frame_tree_delegate_.reset( |
196 new TestFrameTreeDelegateImpl(application_impl())); | 196 new TestFrameTreeDelegateImpl(application_impl())); |
197 scoped_ptr<FrameConnection> frame_connection(new FrameConnection); | 197 scoped_ptr<FrameConnection> frame_connection(new FrameConnection); |
198 FrameConnection* result = frame_connection.get(); | 198 FrameConnection* result = frame_connection.get(); |
199 ViewManagerClientPtr view_manager_client; | 199 ViewTreeClientPtr tree_client; |
200 frame_connection->Init(application_impl(), BuildRequestForURL(url_string), | 200 frame_connection->Init(application_impl(), BuildRequestForURL(url_string), |
201 &view_manager_client); | 201 &tree_client); |
202 FrameTreeClient* frame_tree_client = frame_connection->frame_tree_client(); | 202 FrameTreeClient* frame_tree_client = frame_connection->frame_tree_client(); |
203 frame_tree_.reset(new FrameTree(view, frame_tree_delegate_.get(), | 203 frame_tree_.reset(new FrameTree(view, frame_tree_delegate_.get(), |
204 frame_tree_client, | 204 frame_tree_client, |
205 frame_connection.Pass(), | 205 frame_connection.Pass(), |
206 Frame::ClientPropertyMap())); | 206 Frame::ClientPropertyMap())); |
207 frame_tree_delegate_->set_frame_tree(frame_tree_.get()); | 207 frame_tree_delegate_->set_frame_tree(frame_tree_.get()); |
208 view->Embed(view_manager_client.Pass()); | 208 view->Embed(tree_client.Pass()); |
209 return result; | 209 return result; |
210 } | 210 } |
211 | 211 |
212 bool WaitForNavigateFrame() { | 212 bool WaitForNavigateFrame() { |
213 if (frame_tree_delegate_->waiting_for_navigate()) | 213 if (frame_tree_delegate_->waiting_for_navigate()) |
214 return false; | 214 return false; |
215 | 215 |
216 frame_tree_delegate_->clear_got_navigate(); | 216 frame_tree_delegate_->clear_got_navigate(); |
217 return frame_tree_delegate_->WaitForNavigateFrame(); | 217 return frame_tree_delegate_->WaitForNavigateFrame(); |
218 } | 218 } |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 script_value_as_list->GetString(0u, &message_in_child); | 463 script_value_as_list->GetString(0u, &message_in_child); |
464 } | 464 } |
465 } | 465 } |
466 } while (message_in_child != "hello from parent" && | 466 } while (message_in_child != "hello from parent" && |
467 base::TimeTicks::Now() - start_time < | 467 base::TimeTicks::Now() - start_time < |
468 TestTimeouts::action_timeout()); | 468 TestTimeouts::action_timeout()); |
469 EXPECT_EQ("hello from parent", message_in_child); | 469 EXPECT_EQ("hello from parent", message_in_child); |
470 } | 470 } |
471 | 471 |
472 } // namespace mojo | 472 } // namespace mojo |
OLD | NEW |