OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <algorithm> | 5 #include <algorithm> |
6 #include <initializer_list> | 6 #include <initializer_list> |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1203 content::DOMMessageQueue dom_message_queue(web_contents()); | 1203 content::DOMMessageQueue dom_message_queue(web_contents()); |
1204 ASSERT_TRUE(SimulateMouseMoveToRightFrame()); | 1204 ASSERT_TRUE(SimulateMouseMoveToRightFrame()); |
1205 | 1205 |
1206 // No events are expected from the right frame, so we can't wait for a | 1206 // No events are expected from the right frame, so we can't wait for a |
1207 // dragover event here. Still - we do want to wait until the right frame | 1207 // dragover event here. Still - we do want to wait until the right frame |
1208 // has had a chance to process any previous browser IPCs, so that in case | 1208 // has had a chance to process any previous browser IPCs, so that in case |
1209 // there *is* a bug and a dragover event *does* happen, we won't terminate | 1209 // there *is* a bug and a dragover event *does* happen, we won't terminate |
1210 // the test before the event has had a chance to be reported back to the | 1210 // the test before the event has had a chance to be reported back to the |
1211 // browser. | 1211 // browser. |
1212 std::string expected_response = base::StringPrintf("\"i%d\"", i); | 1212 std::string expected_response = base::StringPrintf("\"i%d\"", i); |
1213 right_frame()->ExecuteJavaScriptWithUserGestureForTests(base::UTF8ToUTF16( | 1213 right_frame()->ExecuteJavaScriptWithUserGestureForTests( |
1214 base::StringPrintf("domAutomationController.setAutomationId(0);\n" | 1214 base::UTF8ToUTF16(base::StringPrintf( |
1215 "domAutomationController.send(%s);\n", | 1215 "domAutomationController.send(%s);\n", expected_response.c_str()))); |
1216 expected_response.c_str()))); | |
1217 | 1216 |
1218 // Wait until our response comes back (it might be mixed with responses | 1217 // Wait until our response comes back (it might be mixed with responses |
1219 // carrying events that are sent by event_monitoring.js). | 1218 // carrying events that are sent by event_monitoring.js). |
1220 std::string actual_response; | 1219 std::string actual_response; |
1221 do { | 1220 do { |
1222 ASSERT_TRUE(dom_message_queue.WaitForMessage(&actual_response)); | 1221 ASSERT_TRUE(dom_message_queue.WaitForMessage(&actual_response)); |
1223 } while (actual_response != expected_response); | 1222 } while (actual_response != expected_response); |
1224 } | 1223 } |
1225 | 1224 |
1226 // Release the mouse button to end the drag. | 1225 // Release the mouse button to end the drag. |
(...skipping 29 matching lines...) Expand all Loading... |
1256 // of a drag operation, and cross-site drags should be allowed across a | 1255 // of a drag operation, and cross-site drags should be allowed across a |
1257 // navigation. | 1256 // navigation. |
1258 | 1257 |
1259 INSTANTIATE_TEST_CASE_P( | 1258 INSTANTIATE_TEST_CASE_P( |
1260 SameSiteSubframe, DragAndDropBrowserTest, ::testing::Values(false)); | 1259 SameSiteSubframe, DragAndDropBrowserTest, ::testing::Values(false)); |
1261 | 1260 |
1262 INSTANTIATE_TEST_CASE_P( | 1261 INSTANTIATE_TEST_CASE_P( |
1263 CrossSiteSubframe, DragAndDropBrowserTest, ::testing::Values(true)); | 1262 CrossSiteSubframe, DragAndDropBrowserTest, ::testing::Values(true)); |
1264 | 1263 |
1265 } // namespace chrome | 1264 } // namespace chrome |
OLD | NEW |