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

Side by Side Diff: content/browser/browser_plugin/browser_plugin_host_browsertest.cc

Issue 65813002: mac: Prepare most test code for -Wunused-functions too. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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 27 matching lines...) Expand all
38 #include "net/test/spawned_test_server/spawned_test_server.h" 38 #include "net/test/spawned_test_server/spawned_test_server.h"
39 #include "third_party/WebKit/public/web/WebInputEvent.h" 39 #include "third_party/WebKit/public/web/WebInputEvent.h"
40 40
41 using blink::WebInputEvent; 41 using blink::WebInputEvent;
42 using blink::WebMouseEvent; 42 using blink::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 {
49
50 const char kHTMLForGuest[] = 48 const char kHTMLForGuest[] =
51 "data:text/html,<html><body>hello world</body></html>"; 49 "data:text/html,<html><body>hello world</body></html>";
50
52 const char kHTMLForGuestTouchHandler[] = 51 const char kHTMLForGuestTouchHandler[] =
53 "data:text/html,<html><body><div id=\"touch\">With touch</div></body>" 52 "data:text/html,<html><body><div id=\"touch\">With touch</div></body>"
54 "<script type=\"text/javascript\">" 53 "<script type=\"text/javascript\">"
55 "function handler() {}" 54 "function handler() {}"
56 "function InstallTouchHandler() { " 55 "function InstallTouchHandler() { "
57 " document.getElementById(\"touch\").addEventListener(\"touchstart\", " 56 " document.getElementById(\"touch\").addEventListener(\"touchstart\", "
58 " handler);" 57 " handler);"
59 "}" 58 "}"
60 "function UninstallTouchHandler() { " 59 "function UninstallTouchHandler() { "
61 " document.getElementById(\"touch\").removeEventListener(\"touchstart\", " 60 " document.getElementById(\"touch\").removeEventListener(\"touchstart\", "
62 " handler);" 61 " handler);"
63 "}" 62 "}"
64 "</script></html>"; 63 "</script></html>";
65 const char kHTMLForGuestWithTitle[] = 64
66 "data:text/html,"
67 "<html><head><title>%s</title></head>"
68 "<body>hello world</body>"
69 "</html>";
70 const char kHTMLForGuestAcceptDrag[] = 65 const char kHTMLForGuestAcceptDrag[] =
71 "data:text/html,<html><body>" 66 "data:text/html,<html><body>"
72 "<script>" 67 "<script>"
73 "function dropped() {" 68 "function dropped() {"
74 " document.title = \"DROPPED\";" 69 " document.title = \"DROPPED\";"
75 "}" 70 "}"
76 "</script>" 71 "</script>"
77 "<textarea id=\"text\" style=\"width:100%; height: 100%\"" 72 "<textarea id=\"text\" style=\"width:100%; height: 100%\""
78 " ondrop=\"dropped();\">" 73 " ondrop=\"dropped();\">"
79 "</textarea>" 74 "</textarea>"
80 "</body></html>"; 75 "</body></html>";
76
81 const char kHTMLForGuestWithSize[] = 77 const char kHTMLForGuestWithSize[] =
82 "data:text/html," 78 "data:text/html,"
83 "<html>" 79 "<html>"
84 "<body style=\"margin: 0px;\">" 80 "<body style=\"margin: 0px;\">"
85 "<img style=\"width: 100%; height: 400px;\"/>" 81 "<img style=\"width: 100%; height: 400px;\"/>"
86 "</body>" 82 "</body>"
87 "</html>"; 83 "</html>";
88 84
89 std::string GetHTMLForGuestWithTitle(const std::string& title) {
90 return base::StringPrintf(kHTMLForGuestWithTitle, title.c_str());
91 }
92
93 } // namespace
94
95 namespace content { 85 namespace content {
96 86
97 // Test factory for creating test instances of BrowserPluginEmbedder and 87 // Test factory for creating test instances of BrowserPluginEmbedder and
98 // BrowserPluginGuest. 88 // BrowserPluginGuest.
99 class TestBrowserPluginHostFactory : public BrowserPluginHostFactory { 89 class TestBrowserPluginHostFactory : public BrowserPluginHostFactory {
100 public: 90 public:
101 virtual BrowserPluginGuestManager* 91 virtual BrowserPluginGuestManager*
102 CreateBrowserPluginGuestManager() OVERRIDE { 92 CreateBrowserPluginGuestManager() OVERRIDE {
103 guest_manager_instance_count_++; 93 guest_manager_instance_count_++;
104 if (message_loop_runner_.get()) 94 if (message_loop_runner_.get())
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 // Attempt a navigation to chrome-guest://abc123, which is a valid URL. But it 804 // Attempt a navigation to chrome-guest://abc123, which is a valid URL. But it
815 // should be blocked because the scheme isn't web-safe or a pseudo-scheme. 805 // should be blocked because the scheme isn't web-safe or a pseudo-scheme.
816 ExecuteSyncJSFunction( 806 ExecuteSyncJSFunction(
817 test_embedder()->web_contents()->GetRenderViewHost(), 807 test_embedder()->web_contents()->GetRenderViewHost(),
818 base::StringPrintf("SetSrc('%s://abc123');", kGuestScheme)); 808 base::StringPrintf("SetSrc('%s://abc123');", kGuestScheme));
819 EXPECT_TRUE(delegate->load_aborted()); 809 EXPECT_TRUE(delegate->load_aborted());
820 EXPECT_TRUE(delegate->load_aborted_url().is_valid()); 810 EXPECT_TRUE(delegate->load_aborted_url().is_valid());
821 } 811 }
822 812
823 } // namespace content 813 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698