OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/singleton.h" | 6 #include "base/memory/singleton.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 using WebKit::WebMouseEvent; | 42 using WebKit::WebMouseEvent; |
43 using content::BrowserPluginEmbedder; | 43 using content::BrowserPluginEmbedder; |
44 using content::BrowserPluginGuest; | 44 using content::BrowserPluginGuest; |
45 using content::BrowserPluginHostFactory; | 45 using content::BrowserPluginHostFactory; |
46 using content::WebContentsImpl; | 46 using content::WebContentsImpl; |
47 | 47 |
48 namespace { | 48 namespace { |
49 | 49 |
50 const char kHTMLForGuest[] = | 50 const char kHTMLForGuest[] = |
51 "data:text/html,<html><body>hello world</body></html>"; | 51 "data:text/html,<html><body>hello world</body></html>"; |
52 const char kHTMLForGuestBusyLoop[] = | |
53 "data:text/html,<html><head><script type=\"text/javascript\">" | |
54 "function PauseMs(timems) {" | |
55 " document.title = \"start\";" | |
56 " var date = new Date();" | |
57 " var currDate = null;" | |
58 " do {" | |
59 " currDate = new Date();" | |
60 " } while (currDate - date < timems)" | |
61 "}" | |
62 "function StartPauseMs(timems) {" | |
63 " setTimeout(function() { PauseMs(timems); }, 0);" | |
64 "}" | |
65 "</script></head><body></body></html>"; | |
66 const char kHTMLForGuestTouchHandler[] = | 52 const char kHTMLForGuestTouchHandler[] = |
67 "data:text/html,<html><body><div id=\"touch\">With touch</div></body>" | 53 "data:text/html,<html><body><div id=\"touch\">With touch</div></body>" |
68 "<script type=\"text/javascript\">" | 54 "<script type=\"text/javascript\">" |
69 "function handler() {}" | 55 "function handler() {}" |
70 "function InstallTouchHandler() { " | 56 "function InstallTouchHandler() { " |
71 " document.getElementById(\"touch\").addEventListener(\"touchstart\", " | 57 " document.getElementById(\"touch\").addEventListener(\"touchstart\", " |
72 " handler);" | 58 " handler);" |
73 "}" | 59 "}" |
74 "function UninstallTouchHandler() { " | 60 "function UninstallTouchHandler() { " |
75 " document.getElementById(\"touch\").removeEventListener(\"touchstart\", " | 61 " document.getElementById(\"touch\").removeEventListener(\"touchstart\", " |
(...skipping 749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 // should be blocked because the scheme isn't web-safe or a pseudo-scheme. | 811 // should be blocked because the scheme isn't web-safe or a pseudo-scheme. |
826 ExecuteSyncJSFunction( | 812 ExecuteSyncJSFunction( |
827 test_embedder()->web_contents()->GetRenderViewHost(), | 813 test_embedder()->web_contents()->GetRenderViewHost(), |
828 base::StringPrintf("SetSrc('%s://abc123');", | 814 base::StringPrintf("SetSrc('%s://abc123');", |
829 chrome::kGuestScheme)); | 815 chrome::kGuestScheme)); |
830 EXPECT_TRUE(delegate->load_aborted()); | 816 EXPECT_TRUE(delegate->load_aborted()); |
831 EXPECT_TRUE(delegate->load_aborted_url().is_valid()); | 817 EXPECT_TRUE(delegate->load_aborted_url().is_valid()); |
832 } | 818 } |
833 | 819 |
834 } // namespace content | 820 } // namespace content |
OLD | NEW |