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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
(...skipping 14 matching lines...) Expand all Loading... | |
25 using mandoline::Frame; | 25 using mandoline::Frame; |
26 using mandoline::FrameConnection; | 26 using mandoline::FrameConnection; |
27 using mandoline::FrameTree; | 27 using mandoline::FrameTree; |
28 using mandoline::FrameTreeClient; | 28 using mandoline::FrameTreeClient; |
29 | 29 |
30 namespace mojo { | 30 namespace mojo { |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 // Switch to enable out of process iframes. | 34 // Switch to enable out of process iframes. |
35 const char kOOPIF[] = "oopifs"; | 35 const char kDisableOOPIF[] = "disable--oopifs"; |
36 | 36 |
37 const char kAddFrameWithEmptyPageScript[] = | 37 const char kAddFrameWithEmptyPageScript[] = |
38 "var iframe = document.createElement(\"iframe\");" | 38 "var iframe = document.createElement(\"iframe\");" |
39 "iframe.src = \"http://127.0.0.1:%u/files/empty_page.html\";" | 39 "iframe.src = \"http://127.0.0.1:%u/files/empty_page.html\";" |
40 "document.body.appendChild(iframe);"; | 40 "document.body.appendChild(iframe);"; |
41 | 41 |
42 bool EnableOOPIFs() { | 42 bool EnableOOPIFs() { |
43 return base::CommandLine::ForCurrentProcess()->HasSwitch(kOOPIF); | 43 if (base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableOOPIF)) |
Fady Samuel
2015/08/14 21:32:36
like previous comment, simply return !this express
| |
44 return false; | |
45 return true; | |
44 } | 46 } |
45 | 47 |
46 mojo::ApplicationConnection* ApplicationConnectionForFrame(Frame* frame) { | 48 mojo::ApplicationConnection* ApplicationConnectionForFrame(Frame* frame) { |
47 return static_cast<FrameConnection*>(frame->user_data()) | 49 return static_cast<FrameConnection*>(frame->user_data()) |
48 ->application_connection(); | 50 ->application_connection(); |
49 } | 51 } |
50 | 52 |
51 std::string GetFrameText(ApplicationConnection* connection) { | 53 std::string GetFrameText(ApplicationConnection* connection) { |
52 html_viewer::TestHTMLViewerPtr test_html_viewer; | 54 html_viewer::TestHTMLViewerPtr test_html_viewer; |
53 connection->ConnectToService(&test_html_viewer); | 55 connection->ConnectToService(&test_html_viewer); |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
489 script_value_as_list->GetString(0u, &message_in_child); | 491 script_value_as_list->GetString(0u, &message_in_child); |
490 } | 492 } |
491 } | 493 } |
492 } while (message_in_child != "hello from parent" && | 494 } while (message_in_child != "hello from parent" && |
493 base::TimeTicks::Now() - start_time < | 495 base::TimeTicks::Now() - start_time < |
494 TestTimeouts::action_timeout()); | 496 TestTimeouts::action_timeout()); |
495 EXPECT_EQ("hello from parent", message_in_child); | 497 EXPECT_EQ("hello from parent", message_in_child); |
496 } | 498 } |
497 | 499 |
498 } // namespace mojo | 500 } // namespace mojo |
OLD | NEW |