| 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/ui/ppapi_uitest.h" | 5 #include "chrome/test/ui/ppapi_uitest.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/test/test_timeouts.h" | 13 #include "base/test/test_timeouts.h" |
| 14 #include "base/timer.h" | 14 #include "base/timer.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/browser_navigator.h" | 17 #include "chrome/browser/ui/browser_navigator.h" |
| 18 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
| 19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/test/base/in_process_browser_test.h" | 20 #include "chrome/test/base/in_process_browser_test.h" |
| 21 #include "chrome/test/base/test_launcher_utils.h" | 21 #include "chrome/test/base/test_launcher_utils.h" |
| 22 #include "chrome/test/base/ui_test_utils.h" | 22 #include "chrome/test/base/ui_test_utils.h" |
| 23 #include "content/public/browser/dom_operation_notification_details.h" | 23 #include "content/public/browser/dom_operation_notification_details.h" |
| 24 #include "content/public/browser/notification_types.h" | 24 #include "content/public/browser/notification_types.h" |
| 25 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 26 #include "content/public/common/content_paths.h" | 26 #include "content/public/common/content_paths.h" |
| 27 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 28 #include "content/public/common/url_constants.h" | 28 #include "content/public/common/url_constants.h" |
| 29 #include "content/public/test/test_renderer_host.h" |
| 29 #include "content/test/gpu/test_switches.h" | 30 #include "content/test/gpu/test_switches.h" |
| 30 #include "media/audio/audio_manager.h" | 31 #include "media/audio/audio_manager.h" |
| 31 #include "net/base/net_util.h" | 32 #include "net/base/net_util.h" |
| 32 #include "net/test/test_server.h" | 33 #include "net/test/test_server.h" |
| 33 #include "ui/gl/gl_switches.h" | 34 #include "ui/gl/gl_switches.h" |
| 34 #include "webkit/plugins/plugin_switches.h" | 35 #include "webkit/plugins/plugin_switches.h" |
| 35 | 36 |
| 36 using content::DomOperationNotificationDetails; | 37 using content::DomOperationNotificationDetails; |
| 37 using content::RenderViewHost; | 38 using content::RenderViewHost; |
| 38 | 39 |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 515 // Times out on Linux. http://crbug.com/108859 | 516 // Times out on Linux. http://crbug.com/108859 |
| 516 #if defined(OS_LINUX) | 517 #if defined(OS_LINUX) |
| 517 #define MAYBE_InputEvent DISABLED_InputEvent | 518 #define MAYBE_InputEvent DISABLED_InputEvent |
| 518 #elif defined(OS_MACOSX) | 519 #elif defined(OS_MACOSX) |
| 519 // Flaky on Mac. http://crbug.com/109258 | 520 // Flaky on Mac. http://crbug.com/109258 |
| 520 #define MAYBE_InputEvent DISABLED_InputEvent | 521 #define MAYBE_InputEvent DISABLED_InputEvent |
| 521 #else | 522 #else |
| 522 #define MAYBE_InputEvent InputEvent | 523 #define MAYBE_InputEvent InputEvent |
| 523 #endif | 524 #endif |
| 524 | 525 |
| 525 TEST_PPAPI_IN_PROCESS(MAYBE_InputEvent) | 526 TEST_PPAPI_IN_PROCESS(InputEvent) |
| 526 TEST_PPAPI_OUT_OF_PROCESS(MAYBE_InputEvent) | 527 TEST_PPAPI_OUT_OF_PROCESS(InputEvent) |
| 527 // TODO(bbudge) Enable when input events are proxied correctly for NaCl. | 528 // TODO(bbudge) Enable when input events are proxied correctly for NaCl. |
| 528 TEST_PPAPI_NACL_VIA_HTTP(DISABLED_InputEvent) | 529 TEST_PPAPI_NACL_VIA_HTTP(DISABLED_InputEvent) |
| 529 | 530 |
| 530 TEST_PPAPI_IN_PROCESS(ImeInputEvent) | 531 TEST_PPAPI_IN_PROCESS(ImeInputEvent) |
| 531 TEST_PPAPI_OUT_OF_PROCESS(ImeInputEvent) | 532 TEST_PPAPI_OUT_OF_PROCESS(ImeInputEvent) |
| 532 // TODO(kinaba) Enable when IME events are proxied correctly for NaCl. | 533 // TODO(kinaba) Enable when IME events are proxied correctly for NaCl. |
| 533 TEST_PPAPI_NACL_VIA_HTTP(DISABLED_ImeInputEvent) | 534 TEST_PPAPI_NACL_VIA_HTTP(DISABLED_ImeInputEvent) |
| 534 | 535 |
| 535 TEST_PPAPI_IN_PROCESS(Instance_ExecuteScript); | 536 TEST_PPAPI_IN_PROCESS(Instance_ExecuteScript); |
| 536 TEST_PPAPI_OUT_OF_PROCESS(Instance_ExecuteScript) | 537 TEST_PPAPI_OUT_OF_PROCESS(Instance_ExecuteScript) |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1101 // Wait for the test completion event. | 1102 // Wait for the test completion event. |
| 1102 observer.Reset(); | 1103 observer.Reset(); |
| 1103 | 1104 |
| 1104 // Switch back to the test tab. | 1105 // Switch back to the test tab. |
| 1105 browser()->ActivateTabAt(0, true); | 1106 browser()->ActivateTabAt(0, true); |
| 1106 | 1107 |
| 1107 ASSERT_TRUE(observer.WaitForFinish()) << "Test timed out."; | 1108 ASSERT_TRUE(observer.WaitForFinish()) << "Test timed out."; |
| 1108 EXPECT_STREQ("PASS", observer.result().c_str()); | 1109 EXPECT_STREQ("PASS", observer.result().c_str()); |
| 1109 } | 1110 } |
| 1110 | 1111 |
| 1112 // Tests that if a plugin accepts touch events, the browser knows to send touch |
| 1113 // events to the renderer. |
| 1114 IN_PROC_BROWSER_TEST_F(PPAPITest, InputEvent_AcceptTouchEvent) { |
| 1115 std::string positive_tests[] = { "InputEvent_AcceptTouchEvent_1", |
| 1116 "InputEvent_AcceptTouchEvent_3", |
| 1117 "InputEvent_AcceptTouchEvent_4" |
| 1118 }; |
| 1119 |
| 1120 for (size_t i = 0; i < arraysize(positive_tests); ++i) { |
| 1121 RenderViewHost* host = browser()->GetActiveWebContents()-> |
| 1122 GetRenderViewHost(); |
| 1123 RunTest(positive_tests[i]); |
| 1124 EXPECT_TRUE(content::RenderViewHostTester::HasTouchEventHandler(host)); |
| 1125 } |
| 1126 |
| 1127 std::string negative_tests[] = { "InputEvent_AcceptTouchEvent_2" }; |
| 1128 for (size_t i = 0; i < arraysize(negative_tests); ++i) { |
| 1129 RenderViewHost* host = browser()->GetActiveWebContents()-> |
| 1130 GetRenderViewHost(); |
| 1131 RunTest(negative_tests[i]); |
| 1132 EXPECT_FALSE(content::RenderViewHostTester::HasTouchEventHandler(host)); |
| 1133 } |
| 1134 } |
| 1135 |
| 1111 TEST_PPAPI_IN_PROCESS(View_SizeChange); | 1136 TEST_PPAPI_IN_PROCESS(View_SizeChange); |
| 1112 TEST_PPAPI_OUT_OF_PROCESS(View_SizeChange); | 1137 TEST_PPAPI_OUT_OF_PROCESS(View_SizeChange); |
| 1113 TEST_PPAPI_NACL_VIA_HTTP(View_SizeChange); | 1138 TEST_PPAPI_NACL_VIA_HTTP(View_SizeChange); |
| 1114 TEST_PPAPI_IN_PROCESS(View_ClipChange); | 1139 TEST_PPAPI_IN_PROCESS(View_ClipChange); |
| 1115 TEST_PPAPI_OUT_OF_PROCESS(View_ClipChange); | 1140 TEST_PPAPI_OUT_OF_PROCESS(View_ClipChange); |
| 1116 TEST_PPAPI_NACL_VIA_HTTP(View_ClipChange); | 1141 TEST_PPAPI_NACL_VIA_HTTP(View_ClipChange); |
| 1117 | 1142 |
| 1118 TEST_PPAPI_IN_PROCESS(ResourceArray_Basics) | 1143 TEST_PPAPI_IN_PROCESS(ResourceArray_Basics) |
| 1119 TEST_PPAPI_IN_PROCESS(ResourceArray_OutOfRangeAccess) | 1144 TEST_PPAPI_IN_PROCESS(ResourceArray_OutOfRangeAccess) |
| 1120 TEST_PPAPI_IN_PROCESS(ResourceArray_EmptyArray) | 1145 TEST_PPAPI_IN_PROCESS(ResourceArray_EmptyArray) |
| 1121 TEST_PPAPI_IN_PROCESS(ResourceArray_InvalidElement) | 1146 TEST_PPAPI_IN_PROCESS(ResourceArray_InvalidElement) |
| 1122 TEST_PPAPI_OUT_OF_PROCESS(ResourceArray_Basics) | 1147 TEST_PPAPI_OUT_OF_PROCESS(ResourceArray_Basics) |
| 1123 TEST_PPAPI_OUT_OF_PROCESS(ResourceArray_OutOfRangeAccess) | 1148 TEST_PPAPI_OUT_OF_PROCESS(ResourceArray_OutOfRangeAccess) |
| 1124 TEST_PPAPI_OUT_OF_PROCESS(ResourceArray_EmptyArray) | 1149 TEST_PPAPI_OUT_OF_PROCESS(ResourceArray_EmptyArray) |
| 1125 TEST_PPAPI_OUT_OF_PROCESS(ResourceArray_InvalidElement) | 1150 TEST_PPAPI_OUT_OF_PROCESS(ResourceArray_InvalidElement) |
| 1126 | 1151 |
| 1127 TEST_PPAPI_IN_PROCESS(FlashMessageLoop_Basics) | 1152 TEST_PPAPI_IN_PROCESS(FlashMessageLoop_Basics) |
| 1128 TEST_PPAPI_IN_PROCESS(FlashMessageLoop_RunWithoutQuit) | 1153 TEST_PPAPI_IN_PROCESS(FlashMessageLoop_RunWithoutQuit) |
| 1129 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_Basics) | 1154 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_Basics) |
| 1130 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_RunWithoutQuit) | 1155 TEST_PPAPI_OUT_OF_PROCESS(FlashMessageLoop_RunWithoutQuit) |
| 1131 | 1156 |
| 1132 TEST_PPAPI_IN_PROCESS(MouseCursor) | 1157 TEST_PPAPI_IN_PROCESS(MouseCursor) |
| 1133 TEST_PPAPI_OUT_OF_PROCESS(MouseCursor) | 1158 TEST_PPAPI_OUT_OF_PROCESS(MouseCursor) |
| 1134 TEST_PPAPI_NACL_VIA_HTTP(MouseCursor) | 1159 TEST_PPAPI_NACL_VIA_HTTP(MouseCursor) |
| 1135 | 1160 |
| 1136 // Only enabled in out-of-process mode. | 1161 // Only enabled in out-of-process mode. |
| 1137 TEST_PPAPI_OUT_OF_PROCESS(FlashFile_CreateTemporaryFile) | 1162 TEST_PPAPI_OUT_OF_PROCESS(FlashFile_CreateTemporaryFile) |
| 1138 | 1163 |
| 1139 #endif // ADDRESS_SANITIZER | 1164 #endif // ADDRESS_SANITIZER |
| OLD | NEW |