| 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 "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 5427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5438 | 5438 |
| 5439 // The main frame should be focused to start with. | 5439 // The main frame should be focused to start with. |
| 5440 EXPECT_EQ(root, root->frame_tree()->GetFocusedFrame()); | 5440 EXPECT_EQ(root, root->frame_tree()->GetFocusedFrame()); |
| 5441 | 5441 |
| 5442 DOMMessageQueue msg_queue; | 5442 DOMMessageQueue msg_queue; |
| 5443 | 5443 |
| 5444 // Register focus and blur events that will send messages when each frame's | 5444 // Register focus and blur events that will send messages when each frame's |
| 5445 // window gets or loses focus. | 5445 // window gets or loses focus. |
| 5446 const char kSetupFocusEvents[] = | 5446 const char kSetupFocusEvents[] = |
| 5447 "window.addEventListener('focus', function() {" | 5447 "window.addEventListener('focus', function() {" |
| 5448 " domAutomationController.setAutomationId(0);" | |
| 5449 " domAutomationController.send('%s-got-focus');" | 5448 " domAutomationController.send('%s-got-focus');" |
| 5450 "});" | 5449 "});" |
| 5451 "window.addEventListener('blur', function() {" | 5450 "window.addEventListener('blur', function() {" |
| 5452 " domAutomationController.setAutomationId(0);" | |
| 5453 " domAutomationController.send('%s-lost-focus');" | 5451 " domAutomationController.send('%s-lost-focus');" |
| 5454 "});"; | 5452 "});"; |
| 5455 std::string script = base::StringPrintf(kSetupFocusEvents, "main", "main"); | 5453 std::string script = base::StringPrintf(kSetupFocusEvents, "main", "main"); |
| 5456 ExecuteScriptAsync(shell(), script); | 5454 ExecuteScriptAsync(shell(), script); |
| 5457 script = base::StringPrintf(kSetupFocusEvents, "child1", "child1"); | 5455 script = base::StringPrintf(kSetupFocusEvents, "child1", "child1"); |
| 5458 ExecuteScriptAsync(child1, script); | 5456 ExecuteScriptAsync(child1, script); |
| 5459 script = base::StringPrintf(kSetupFocusEvents, "child2", "child2"); | 5457 script = base::StringPrintf(kSetupFocusEvents, "child2", "child2"); |
| 5460 ExecuteScriptAsync(child2, script); | 5458 ExecuteScriptAsync(child2, script); |
| 5461 | 5459 |
| 5462 // Execute window.focus on the B subframe from the A main frame. | 5460 // Execute window.focus on the B subframe from the A main frame. |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5627 // alternate events, so only every other wheel generates a scroll. The fact | 5625 // alternate events, so only every other wheel generates a scroll. The fact |
| 5628 // that any scroll events fire is dependent on the event going to the main | 5626 // that any scroll events fire is dependent on the event going to the main |
| 5629 // thread, which requires the nonFastScrollableRegion be set correctly | 5627 // thread, which requires the nonFastScrollableRegion be set correctly |
| 5630 // on the compositor. | 5628 // on the compositor. |
| 5631 std::string script = | 5629 std::string script = |
| 5632 "wheel_count = 0;" | 5630 "wheel_count = 0;" |
| 5633 "function wheel_handler(e) {" | 5631 "function wheel_handler(e) {" |
| 5634 " wheel_count++;" | 5632 " wheel_count++;" |
| 5635 " if (wheel_count % 2 == 0)" | 5633 " if (wheel_count % 2 == 0)" |
| 5636 " e.preventDefault();\n" | 5634 " e.preventDefault();\n" |
| 5637 " domAutomationController.setAutomationId(0);" | |
| 5638 " domAutomationController.send('wheel: ' + wheel_count);" | 5635 " domAutomationController.send('wheel: ' + wheel_count);" |
| 5639 "}" | 5636 "}" |
| 5640 "function scroll_handler(e) {" | 5637 "function scroll_handler(e) {" |
| 5641 " domAutomationController.setAutomationId(0);" | |
| 5642 " domAutomationController.send('scroll: ' + wheel_count);" | 5638 " domAutomationController.send('scroll: ' + wheel_count);" |
| 5643 "}" | 5639 "}" |
| 5644 "scroll_div = document.getElementById('scrollable_div');" | 5640 "scroll_div = document.getElementById('scrollable_div');" |
| 5645 "scroll_div.addEventListener('wheel', wheel_handler);" | 5641 "scroll_div.addEventListener('wheel', wheel_handler);" |
| 5646 "scroll_div.addEventListener('scroll', scroll_handler);" | 5642 "scroll_div.addEventListener('scroll', scroll_handler);" |
| 5647 "document.body.style.background = 'black';"; | 5643 "document.body.style.background = 'black';"; |
| 5648 | 5644 |
| 5649 content::DOMMessageQueue msg_queue; | 5645 content::DOMMessageQueue msg_queue; |
| 5650 std::string reply; | 5646 std::string reply; |
| 5651 EXPECT_TRUE(ExecuteScript(rfh, script)); | 5647 EXPECT_TRUE(ExecuteScript(rfh, script)); |
| (...skipping 5127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10779 SimpleTap(gfx::Point(point_outside_iframe.x(), point_outside_iframe.y())); | 10775 SimpleTap(gfx::Point(point_outside_iframe.x(), point_outside_iframe.y())); |
| 10780 selection_controller_client->Wait(); | 10776 selection_controller_client->Wait(); |
| 10781 | 10777 |
| 10782 EXPECT_EQ(ui::TouchSelectionController::INACTIVE, | 10778 EXPECT_EQ(ui::TouchSelectionController::INACTIVE, |
| 10783 parent_view->touch_selection_controller()->active_status()); | 10779 parent_view->touch_selection_controller()->active_status()); |
| 10784 } | 10780 } |
| 10785 | 10781 |
| 10786 #endif // defined(OS_ANDROID) | 10782 #endif // defined(OS_ANDROID) |
| 10787 | 10783 |
| 10788 } // namespace content | 10784 } // namespace content |
| OLD | NEW |