| 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/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 const size_t initial_frame_count = parent->children().size(); | 192 const size_t initial_frame_count = parent->children().size(); |
| 193 // Dynamically add a new frame. | 193 // Dynamically add a new frame. |
| 194 ExecuteScript(ApplicationConnectionForFrame(parent), | 194 ExecuteScript(ApplicationConnectionForFrame(parent), |
| 195 AddPortToString(kAddFrameWithEmptyPageScript)); | 195 AddPortToString(kAddFrameWithEmptyPageScript)); |
| 196 | 196 |
| 197 frame_tree_delegate_->WaitForChildFrameCount(parent, | 197 frame_tree_delegate_->WaitForChildFrameCount(parent, |
| 198 initial_frame_count + 1); | 198 initial_frame_count + 1); |
| 199 if (HasFatalFailure()) | 199 if (HasFatalFailure()) |
| 200 return nullptr; | 200 return nullptr; |
| 201 | 201 |
| 202 return parent->FindFrame(parent->view()->children().back()->id()); | 202 return parent->FindFrame(parent->window()->children().back()->id()); |
| 203 } | 203 } |
| 204 | 204 |
| 205 std::string AddPortToString(const std::string& string) { | 205 std::string AddPortToString(const std::string& string) { |
| 206 const uint16_t assigned_port = http_server_->host_port_pair().port(); | 206 const uint16_t assigned_port = http_server_->host_port_pair().port(); |
| 207 return base::StringPrintf(string.c_str(), assigned_port); | 207 return base::StringPrintf(string.c_str(), assigned_port); |
| 208 } | 208 } |
| 209 | 209 |
| 210 mojo::URLRequestPtr BuildRequestForURL(const std::string& url_string) { | 210 mojo::URLRequestPtr BuildRequestForURL(const std::string& url_string) { |
| 211 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 211 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 212 request->url = mojo::String::From(AddPortToString(url_string)); | 212 request->url = mojo::String::From(AddPortToString(url_string)); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 script_value_as_list->GetString(0u, &message_in_child); | 473 script_value_as_list->GetString(0u, &message_in_child); |
| 474 } | 474 } |
| 475 } | 475 } |
| 476 } while (message_in_child != "hello from parent" && | 476 } while (message_in_child != "hello from parent" && |
| 477 base::TimeTicks::Now() - start_time < | 477 base::TimeTicks::Now() - start_time < |
| 478 TestTimeouts::action_timeout()); | 478 TestTimeouts::action_timeout()); |
| 479 EXPECT_EQ("hello from parent", message_in_child); | 479 EXPECT_EQ("hello from parent", message_in_child); |
| 480 } | 480 } |
| 481 | 481 |
| 482 } // namespace mojo | 482 } // namespace mojo |
| OLD | NEW |