| 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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 598 // This test verifies that if IME is enabled in the embedder, it is also enabled | 598 // This test verifies that if IME is enabled in the embedder, it is also enabled |
| 599 // in the guest. | 599 // in the guest. |
| 600 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, VerifyInputMethodActive) { | 600 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, VerifyInputMethodActive) { |
| 601 const char* kEmbedderURL = "/browser_plugin_embedder.html"; | 601 const char* kEmbedderURL = "/browser_plugin_embedder.html"; |
| 602 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); | 602 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); |
| 603 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( | 603 RenderViewHostImpl* rvh = static_cast<RenderViewHostImpl*>( |
| 604 test_guest()->web_contents()->GetRenderViewHost()); | 604 test_guest()->web_contents()->GetRenderViewHost()); |
| 605 EXPECT_TRUE(rvh->input_method_active()); | 605 EXPECT_TRUE(rvh->input_method_active()); |
| 606 } | 606 } |
| 607 | 607 |
| 608 // Verify that navigating to an invalid URL (e.g. 'http:') doesn't cause | |
| 609 // a crash. | |
| 610 IN_PROC_BROWSER_TEST_F(BrowserPluginHostTest, DoNotCrashOnInvalidNavigation) { | |
| 611 const char kEmbedderURL[] = "/browser_plugin_embedder.html"; | |
| 612 StartBrowserPluginTest(kEmbedderURL, kHTMLForGuest, true, std::string()); | |
| 613 TestBrowserPluginGuestDelegate* delegate = | |
| 614 new TestBrowserPluginGuestDelegate(); | |
| 615 test_guest()->SetDelegate(delegate); | |
| 616 | |
| 617 const char kValidSchemeWithEmptyURL[] = "http:"; | |
| 618 ExecuteSyncJSFunction( | |
| 619 test_embedder()->web_contents()->GetMainFrame(), | |
| 620 base::StringPrintf("SetSrc('%s');", kValidSchemeWithEmptyURL)); | |
| 621 EXPECT_TRUE(delegate->load_aborted()); | |
| 622 EXPECT_FALSE(delegate->load_aborted_url().is_valid()); | |
| 623 EXPECT_EQ(kValidSchemeWithEmptyURL, | |
| 624 delegate->load_aborted_url().possibly_invalid_spec()); | |
| 625 | |
| 626 delegate->ResetStates(); | |
| 627 | |
| 628 // Attempt a navigation to chrome-guest://abc123, which is a valid URL. But it | |
| 629 // should be blocked because the scheme isn't web-safe or a pseudo-scheme. | |
| 630 ExecuteSyncJSFunction( | |
| 631 test_embedder()->web_contents()->GetMainFrame(), | |
| 632 base::StringPrintf("SetSrc('%s://abc123');", kGuestScheme)); | |
| 633 EXPECT_TRUE(delegate->load_aborted()); | |
| 634 EXPECT_TRUE(delegate->load_aborted_url().is_valid()); | |
| 635 } | |
| 636 | |
| 637 // Tests involving the threaded compositor. | 608 // Tests involving the threaded compositor. |
| 638 class BrowserPluginThreadedCompositorTest : public BrowserPluginHostTest { | 609 class BrowserPluginThreadedCompositorTest : public BrowserPluginHostTest { |
| 639 public: | 610 public: |
| 640 BrowserPluginThreadedCompositorTest() {} | 611 BrowserPluginThreadedCompositorTest() {} |
| 641 virtual ~BrowserPluginThreadedCompositorTest() {} | 612 virtual ~BrowserPluginThreadedCompositorTest() {} |
| 642 | 613 |
| 643 protected: | 614 protected: |
| 644 virtual void SetUpCommandLine(CommandLine* cmd) OVERRIDE { | 615 virtual void SetUpCommandLine(CommandLine* cmd) OVERRIDE { |
| 645 BrowserPluginHostTest::SetUpCommandLine(cmd); | 616 BrowserPluginHostTest::SetUpCommandLine(cmd); |
| 646 cmd->AppendSwitch(switches::kEnableThreadedCompositing); | 617 cmd->AppendSwitch(switches::kEnableThreadedCompositing); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 scoped_ptr<base::Value> value = | 883 scoped_ptr<base::Value> value = |
| 913 content::ExecuteScriptAndGetValue( | 884 content::ExecuteScriptAndGetValue( |
| 914 guest_rfh, "document.getElementById('input1').value"); | 885 guest_rfh, "document.getElementById('input1').value"); |
| 915 std::string actual_value; | 886 std::string actual_value; |
| 916 ASSERT_TRUE(value->GetAsString(&actual_value)); | 887 ASSERT_TRUE(value->GetAsString(&actual_value)); |
| 917 EXPECT_EQ(base::UTF16ToUTF8(expected_value), actual_value); | 888 EXPECT_EQ(base::UTF16ToUTF8(expected_value), actual_value); |
| 918 } | 889 } |
| 919 } | 890 } |
| 920 | 891 |
| 921 } // namespace content | 892 } // namespace content |
| OLD | NEW |