OLD | NEW |
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 "chrome/test/ppapi/ppapi_test.h" | 5 #include "chrome/test/ppapi/ppapi_test.h" |
6 | 6 |
7 #include "base/test/test_timeouts.h" | 7 #include "base/test/test_timeouts.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "chrome/browser/content_settings/host_content_settings_map.h" | 9 #include "chrome/browser/content_settings/host_content_settings_map.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_navigator.h" | 12 #include "chrome/browser/ui/browser_navigator.h" |
13 #include "chrome/browser/ui/browser_tabstrip.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
14 #include "chrome/test/base/javascript_test_observer.h" | 14 #include "chrome/test/base/javascript_test_observer.h" |
15 #include "chrome/test/base/ui_test_utils.h" | 15 #include "chrome/test/base/ui_test_utils.h" |
16 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
17 #include "content/public/common/url_constants.h" | 17 #include "content/public/common/url_constants.h" |
18 #include "content/public/test/test_renderer_host.h" | 18 #include "content/public/test/test_renderer_host.h" |
19 | 19 |
20 using content::RenderViewHost; | 20 using content::RenderViewHost; |
21 | 21 |
22 // This macro finesses macro expansion to do what we want. | 22 // This macro finesses macro expansion to do what we want. |
23 #define STRIP_PREFIXES(test_name) StripPrefixes(#test_name) | 23 #define STRIP_PREFIXES(test_name) StripPrefixes(#test_name) |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
800 chrome::NavigateParams params(browser(), url, content::PAGE_TRANSITION_LINK); | 800 chrome::NavigateParams params(browser(), url, content::PAGE_TRANSITION_LINK); |
801 params.disposition = NEW_BACKGROUND_TAB; | 801 params.disposition = NEW_BACKGROUND_TAB; |
802 ui_test_utils::NavigateToURL(¶ms); | 802 ui_test_utils::NavigateToURL(¶ms); |
803 } | 803 } |
804 | 804 |
805 // This test messes with tab visibility so is custom. | 805 // This test messes with tab visibility so is custom. |
806 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, View_PageHideShow) { | 806 IN_PROC_BROWSER_TEST_F(OutOfProcessPPAPITest, View_PageHideShow) { |
807 // The plugin will be loaded in the foreground tab and will send us a message. | 807 // The plugin will be loaded in the foreground tab and will send us a message. |
808 PPAPITestMessageHandler handler; | 808 PPAPITestMessageHandler handler; |
809 JavascriptTestObserver observer( | 809 JavascriptTestObserver observer( |
810 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), | 810 browser()->tab_strip_model()->GetActiveWebContents()->GetRenderViewHost(), |
811 &handler); | 811 &handler); |
812 | 812 |
813 GURL url = GetTestFileUrl("View_PageHideShow"); | 813 GURL url = GetTestFileUrl("View_PageHideShow"); |
814 ui_test_utils::NavigateToURL(browser(), url); | 814 ui_test_utils::NavigateToURL(browser(), url); |
815 | 815 |
816 ASSERT_TRUE(observer.Run()) << handler.error_message(); | 816 ASSERT_TRUE(observer.Run()) << handler.error_message(); |
817 EXPECT_STREQ("TestPageHideShow:Created", handler.message().c_str()); | 817 EXPECT_STREQ("TestPageHideShow:Created", handler.message().c_str()); |
818 observer.Reset(); | 818 observer.Reset(); |
819 | 819 |
820 // Make a new tab to cause the original one to hide, this should trigger the | 820 // Make a new tab to cause the original one to hide, this should trigger the |
821 // next phase of the test. | 821 // next phase of the test. |
822 chrome::NavigateParams params(browser(), GURL(chrome::kAboutBlankURL), | 822 chrome::NavigateParams params(browser(), GURL(chrome::kAboutBlankURL), |
823 content::PAGE_TRANSITION_LINK); | 823 content::PAGE_TRANSITION_LINK); |
824 params.disposition = NEW_FOREGROUND_TAB; | 824 params.disposition = NEW_FOREGROUND_TAB; |
825 ui_test_utils::NavigateToURL(¶ms); | 825 ui_test_utils::NavigateToURL(¶ms); |
826 | 826 |
827 // Wait until the test acks that it got hidden. | 827 // Wait until the test acks that it got hidden. |
828 ASSERT_TRUE(observer.Run()) << handler.error_message(); | 828 ASSERT_TRUE(observer.Run()) << handler.error_message(); |
829 EXPECT_STREQ("TestPageHideShow:Hidden", handler.message().c_str()); | 829 EXPECT_STREQ("TestPageHideShow:Hidden", handler.message().c_str()); |
830 observer.Reset(); | 830 observer.Reset(); |
831 | 831 |
832 // Switch back to the test tab. | 832 // Switch back to the test tab. |
833 chrome::ActivateTabAt(browser(), 0, true); | 833 browser()->tab_strip_model()->ActivateTabAt(0, true); |
834 | 834 |
835 ASSERT_TRUE(observer.Run()) << handler.error_message(); | 835 ASSERT_TRUE(observer.Run()) << handler.error_message(); |
836 EXPECT_STREQ("PASS", handler.message().c_str()); | 836 EXPECT_STREQ("PASS", handler.message().c_str()); |
837 } | 837 } |
838 | 838 |
839 // Tests that if a plugin accepts touch events, the browser knows to send touch | 839 // Tests that if a plugin accepts touch events, the browser knows to send touch |
840 // events to the renderer. | 840 // events to the renderer. |
841 IN_PROC_BROWSER_TEST_F(PPAPITest, InputEvent_AcceptTouchEvent) { | 841 IN_PROC_BROWSER_TEST_F(PPAPITest, InputEvent_AcceptTouchEvent) { |
842 std::string positive_tests[] = { "InputEvent_AcceptTouchEvent_1", | 842 std::string positive_tests[] = { "InputEvent_AcceptTouchEvent_1", |
843 "InputEvent_AcceptTouchEvent_2", | 843 "InputEvent_AcceptTouchEvent_2", |
844 "InputEvent_AcceptTouchEvent_3", | 844 "InputEvent_AcceptTouchEvent_3", |
845 "InputEvent_AcceptTouchEvent_4" | 845 "InputEvent_AcceptTouchEvent_4" |
846 }; | 846 }; |
847 | 847 |
848 for (size_t i = 0; i < arraysize(positive_tests); ++i) { | 848 for (size_t i = 0; i < arraysize(positive_tests); ++i) { |
849 RenderViewHost* host = chrome::GetActiveWebContents(browser())-> | 849 RenderViewHost* host = browser()->tab_strip_model()-> |
850 GetRenderViewHost(); | 850 GetActiveWebContents()->GetRenderViewHost(); |
851 RunTest(positive_tests[i]); | 851 RunTest(positive_tests[i]); |
852 EXPECT_TRUE(content::RenderViewHostTester::HasTouchEventHandler(host)); | 852 EXPECT_TRUE(content::RenderViewHostTester::HasTouchEventHandler(host)); |
853 } | 853 } |
854 } | 854 } |
855 | 855 |
856 TEST_PPAPI_IN_PROCESS(View_SizeChange); | 856 TEST_PPAPI_IN_PROCESS(View_SizeChange); |
857 TEST_PPAPI_OUT_OF_PROCESS(View_SizeChange); | 857 TEST_PPAPI_OUT_OF_PROCESS(View_SizeChange); |
858 TEST_PPAPI_NACL_VIA_HTTP(View_SizeChange); | 858 TEST_PPAPI_NACL_VIA_HTTP(View_SizeChange); |
859 TEST_PPAPI_IN_PROCESS(View_ClipChange); | 859 TEST_PPAPI_IN_PROCESS(View_ClipChange); |
860 TEST_PPAPI_OUT_OF_PROCESS(View_ClipChange); | 860 TEST_PPAPI_OUT_OF_PROCESS(View_ClipChange); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
904 #define MAYBE_FlashFullscreen DISABLED_FlashFullscreen | 904 #define MAYBE_FlashFullscreen DISABLED_FlashFullscreen |
905 #else | 905 #else |
906 #define MAYBE_FlashFullscreen FlashFullscreen | 906 #define MAYBE_FlashFullscreen FlashFullscreen |
907 #endif | 907 #endif |
908 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_FlashFullscreen) | 908 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_FlashFullscreen) |
909 | 909 |
910 TEST_PPAPI_IN_PROCESS(TalkPrivate) | 910 TEST_PPAPI_IN_PROCESS(TalkPrivate) |
911 TEST_PPAPI_OUT_OF_PROCESS(TalkPrivate) | 911 TEST_PPAPI_OUT_OF_PROCESS(TalkPrivate) |
912 | 912 |
913 #endif // ADDRESS_SANITIZER | 913 #endif // ADDRESS_SANITIZER |
OLD | NEW |