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

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

Issue 12605011: Revert 188912 "Removed static factories for data, ftp, file, and..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 9 months 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/string_util.h" 8 #include "base/string_util.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/test/test_timeouts.h" 10 #include "base/test/test_timeouts.h"
11 #include "base/utf_string_conversions.h" 11 #include "base/utf_string_conversions.h"
12 #include "content/browser/browser_plugin/browser_plugin_guest.h" 12 #include "content/browser/browser_plugin/browser_plugin_guest.h"
13 #include "content/browser/browser_plugin/browser_plugin_host_factory.h" 13 #include "content/browser/browser_plugin/browser_plugin_host_factory.h"
14 #include "content/browser/browser_plugin/test_browser_plugin_embedder.h" 14 #include "content/browser/browser_plugin/test_browser_plugin_embedder.h"
15 #include "content/browser/browser_plugin/test_browser_plugin_guest.h" 15 #include "content/browser/browser_plugin/test_browser_plugin_guest.h"
16 #include "content/browser/browser_plugin/test_browser_plugin_guest_manager.h" 16 #include "content/browser/browser_plugin/test_browser_plugin_guest_manager.h"
17 #include "content/browser/child_process_security_policy_impl.h"
18 #include "content/browser/renderer_host/render_view_host_impl.h" 17 #include "content/browser/renderer_host/render_view_host_impl.h"
19 #include "content/browser/web_contents/web_contents_impl.h" 18 #include "content/browser/web_contents/web_contents_impl.h"
20 #include "content/common/view_messages.h" 19 #include "content/common/view_messages.h"
21 #include "content/public/browser/notification_service.h" 20 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/notification_types.h" 21 #include "content/public/browser/notification_types.h"
23 #include "content/public/browser/render_view_host_observer.h" 22 #include "content/public/browser/render_view_host_observer.h"
24 #include "content/public/browser/render_widget_host_view.h" 23 #include "content/public/browser/render_widget_host_view.h"
25 #include "content/public/common/content_switches.h" 24 #include "content/public/common/content_switches.h"
26 #include "content/public/test/browser_test_utils.h" 25 #include "content/public/test/browser_test_utils.h"
27 #include "content/public/test/test_utils.h" 26 #include "content/public/test/test_utils.h"
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 test_embedder()->web_contents()->GetRenderViewHost()); 845 test_embedder()->web_contents()->GetRenderViewHost());
847 GURL test_url = test_server()->GetURL("close-socket"); 846 GURL test_url = test_server()->GetURL("close-socket");
848 ExecuteSyncJSFunction( 847 ExecuteSyncJSFunction(
849 rvh, base::StringPrintf("SetSrc('%s');", test_url.spec().c_str())); 848 rvh, base::StringPrintf("SetSrc('%s');", test_url.spec().c_str()));
850 string16 actual_title = title_watcher.WaitAndGetTitle(); 849 string16 actual_title = title_watcher.WaitAndGetTitle();
851 EXPECT_EQ(expected_title, actual_title); 850 EXPECT_EQ(expected_title, actual_title);
852 } 851 }
853 852
854 { 853 {
855 // Navigate the guest to an illegal chrome:// URL. 854 // Navigate the guest to an illegal chrome:// URL.
856 GURL test_url("chrome://newtab");
857 ChildProcessSecurityPolicyImpl* policy =
858 ChildProcessSecurityPolicyImpl::GetInstance();
859 // Register chrome:// as a safe scheme so as to bypass
860 // ChildProcessSecurityPolicyImpl::CanRequestURL().
861 if (!policy->IsWebSafeScheme(test_url.scheme()))
862 policy->RegisterWebSafeScheme(test_url.scheme());
863 const string16 expected_title = ASCIIToUTF16("ERR_INVALID_URL"); 855 const string16 expected_title = ASCIIToUTF16("ERR_INVALID_URL");
864 content::TitleWatcher title_watcher(test_embedder()->web_contents(), 856 content::TitleWatcher title_watcher(test_embedder()->web_contents(),
865 expected_title); 857 expected_title);
866 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( 858 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
867 test_embedder()->web_contents()->GetRenderViewHost()); 859 test_embedder()->web_contents()->GetRenderViewHost());
860 GURL test_url("chrome://newtab");
868 ExecuteSyncJSFunction( 861 ExecuteSyncJSFunction(
869 rvh, base::StringPrintf("SetSrc('%s');", test_url.spec().c_str())); 862 rvh, base::StringPrintf("SetSrc('%s');", test_url.spec().c_str()));
870 string16 actual_title = title_watcher.WaitAndGetTitle(); 863 string16 actual_title = title_watcher.WaitAndGetTitle();
871 EXPECT_EQ(expected_title, actual_title); 864 EXPECT_EQ(expected_title, actual_title);
872 } 865 }
873 866
874 { 867 {
875 // Navigate the guest to an illegal file:// URL. 868 // Navigate the guest to an illegal file:// URL.
876 const string16 expected_title = ASCIIToUTF16("ERR_ABORTED"); 869 const string16 expected_title = ASCIIToUTF16("ERR_ABORTED");
877 content::TitleWatcher title_watcher(test_embedder()->web_contents(), 870 content::TitleWatcher title_watcher(test_embedder()->web_contents(),
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
1398 const string16 expected_title = ASCIIToUTF16("AutoSize(640, 480)"); 1391 const string16 expected_title = ASCIIToUTF16("AutoSize(640, 480)");
1399 content::TitleWatcher title_watcher(test_embedder()->web_contents(), 1392 content::TitleWatcher title_watcher(test_embedder()->web_contents(),
1400 expected_title); 1393 expected_title);
1401 RemoveAttributes(rvh, "maxwidth"); 1394 RemoveAttributes(rvh, "maxwidth");
1402 string16 actual_title = title_watcher.WaitAndGetTitle(); 1395 string16 actual_title = title_watcher.WaitAndGetTitle();
1403 EXPECT_EQ(expected_title, actual_title); 1396 EXPECT_EQ(expected_title, actual_title);
1404 } 1397 }
1405 } 1398 }
1406 1399
1407 } // namespace content 1400 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698