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

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

Issue 272573005: <webview>: Move NewWindow API to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@guestview_manager_rename
Patch Set: Cleanup and fix tests Created 6 years, 7 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
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 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 // This test verifies that if IME is enabled in the embedder, it is also enabled 683 // This test verifies that if IME is enabled in the embedder, it is also enabled
684 // in the guest. 684 // in the guest.
685 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, VerifyInputMethodActive) { 685 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, VerifyInputMethodActive) {
686 const char* kEmbedderURL = "/browser_plugin_embedder.html"; 686 const char* kEmbedderURL = "/browser_plugin_embedder.html";
687 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); 687 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string());
688 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( 688 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>(
689 test_guest()->web_contents()->GetRenderViewHost()); 689 test_guest()->web_contents()->GetRenderViewHost());
690 EXPECT_TRUE(rvh->input_method_active()); 690 EXPECT_TRUE(rvh->input_method_active());
691 } 691 }
692 692
693 // Verify that navigating to an invalid URL (e.g. 'http:') doesn't cause
694 // a crash.
695 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, DoNotCrashOnInvalidNavigation) {
696 const char kEmbedderURL[] = "/browser_plugin_embedder.html";
697 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string());
698 TestBrowserPluginGuestDelegate* delegate =
699 new TestBrowserPluginGuestDelegate();
700 test_guest()->SetDelegate(delegate);
701
702 const char kValidSchemeWithEmptyURL[] = "http:";
703 ExecuteSyncJSFunction(
704 test_embedder()->web_contents()->GetMainFrame(),
705 base::StringPrintf("SetSrc('%s');", kValidSchemeWithEmptyURL));
706 EXPECT_TRUE(delegate->load_aborted());
707 EXPECT_FALSE(delegate->load_aborted_url().is_valid());
708 EXPECT_EQ(kValidSchemeWithEmptyURL,
709 delegate->load_aborted_url().possibly_invalid_spec());
710
711 delegate->ResetStates();
712
713 // Attempt a navigation to chrome-guest://abc123, which is a valid URL. But it
714 // should be blocked because the scheme isn't web-safe or a pseudo-scheme.
715 ExecuteSyncJSFunction(
716 test_embedder()->web_contents()->GetMainFrame(),
717 base::StringPrintf("SetSrc('%s://abc123');", kGuestScheme));
718 EXPECT_TRUE(delegate->load_aborted());
719 EXPECT_TRUE(delegate->load_aborted_url().is_valid());
720 }
721
722 // Tests involving the threaded compositor. 693 // Tests involving the threaded compositor.
723 class BrowserPluginThreadedCompositorTest : public BrowserPluginHostTest { 694 class BrowserPluginThreadedCompositorTest : public BrowserPluginHostTest {
724 public: 695 public:
725 BrowserPluginThreadedCompositorTest() {} 696 BrowserPluginThreadedCompositorTest() {}
726 virtual ~BrowserPluginThreadedCompositorTest() {} 697 virtual ~BrowserPluginThreadedCompositorTest() {}
727 698
728 protected: 699 protected:
729 virtual void SetUpCommandLine(CommandLine* cmd) OVERRIDE { 700 virtual void SetUpCommandLine(CommandLine* cmd) OVERRIDE {
730 BrowserPluginHostTest::SetUpCommandLine(cmd); 701 BrowserPluginHostTest::SetUpCommandLine(cmd);
731 cmd->AppendSwitch(switches::kEnableThreadedCompositing); 702 cmd->AppendSwitch(switches::kEnableThreadedCompositing);
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
997 scoped_ptr<base::Value> value = 968 scoped_ptr<base::Value> value =
998 content::ExecuteScriptAndGetValue( 969 content::ExecuteScriptAndGetValue(
999 guest_rfh, "document.getElementById('input1').value"); 970 guest_rfh, "document.getElementById('input1').value");
1000 std::string actual_value; 971 std::string actual_value;
1001 ASSERT_TRUE(value->GetAsString(&actual_value)); 972 ASSERT_TRUE(value->GetAsString(&actual_value));
1002 EXPECT_EQ(base::UTF16ToUTF8(expected_value), actual_value); 973 EXPECT_EQ(base::UTF16ToUTF8(expected_value), actual_value);
1003 } 974 }
1004 } 975 }
1005 976
1006 } // namespace content 977 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698