| 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 "base/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/browser_tabstrip.h" | 8 #include "chrome/browser/ui/browser_tabstrip.h" |
| 9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
| 11 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
| 12 #include "content/public/browser/web_contents_view.h" | 12 #include "content/public/browser/web_contents_view.h" |
| 13 #include "content/public/test/browser_test_utils.h" |
| 13 #include "ui/ui_controls/ui_controls.h" | 14 #include "ui/ui_controls/ui_controls.h" |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| 17 class MouseLeaveTest : public InProcessBrowserTest { | 18 class MouseLeaveTest : public InProcessBrowserTest { |
| 18 public: | 19 public: |
| 19 MouseLeaveTest() {} | 20 MouseLeaveTest() {} |
| 20 | 21 |
| 21 DISALLOW_COPY_AND_ASSIGN(MouseLeaveTest); | 22 DISALLOW_COPY_AND_ASSIGN(MouseLeaveTest); |
| 22 }; | 23 }; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 44 tab_view_bounds.y() + 10); | 45 tab_view_bounds.y() + 10); |
| 45 gfx::Point above_content_point( | 46 gfx::Point above_content_point( |
| 46 tab_view_bounds.x() + tab_view_bounds.width() / 2, | 47 tab_view_bounds.x() + tab_view_bounds.width() / 2, |
| 47 tab_view_bounds.y() - 2); | 48 tab_view_bounds.y() - 2); |
| 48 | 49 |
| 49 // Start by moving the point just above the content. | 50 // Start by moving the point just above the content. |
| 50 ui_controls::SendMouseMove(above_content_point.x(), above_content_point.y()); | 51 ui_controls::SendMouseMove(above_content_point.x(), above_content_point.y()); |
| 51 | 52 |
| 52 // Navigate to the test html page. | 53 // Navigate to the test html page. |
| 53 string16 load_expected_title(ASCIIToUTF16("onload")); | 54 string16 load_expected_title(ASCIIToUTF16("onload")); |
| 54 ui_test_utils::TitleWatcher load_title_watcher(tab, load_expected_title); | 55 content::TitleWatcher load_title_watcher(tab, load_expected_title); |
| 55 ui_test_utils::NavigateToURL(browser(), test_url); | 56 ui_test_utils::NavigateToURL(browser(), test_url); |
| 56 // Wait for the onload() handler to complete so we can do the | 57 // Wait for the onload() handler to complete so we can do the |
| 57 // next part of the test. | 58 // next part of the test. |
| 58 EXPECT_EQ(load_expected_title, load_title_watcher.WaitAndGetTitle()); | 59 EXPECT_EQ(load_expected_title, load_title_watcher.WaitAndGetTitle()); |
| 59 | 60 |
| 60 // Move the cursor to the top-center of the content, which will trigger | 61 // Move the cursor to the top-center of the content, which will trigger |
| 61 // a javascript onMouseOver event. | 62 // a javascript onMouseOver event. |
| 62 ui_controls::SendMouseMove(in_content_point.x(), in_content_point.y()); | 63 ui_controls::SendMouseMove(in_content_point.x(), in_content_point.y()); |
| 63 | 64 |
| 64 // Wait on the correct intermediate title. | 65 // Wait on the correct intermediate title. |
| 65 string16 entered_expected_title(ASCIIToUTF16("entered")); | 66 string16 entered_expected_title(ASCIIToUTF16("entered")); |
| 66 ui_test_utils::TitleWatcher entered_title_watcher( | 67 content::TitleWatcher entered_title_watcher(tab, entered_expected_title); |
| 67 tab, entered_expected_title); | |
| 68 EXPECT_EQ(entered_expected_title, entered_title_watcher.WaitAndGetTitle()); | 68 EXPECT_EQ(entered_expected_title, entered_title_watcher.WaitAndGetTitle()); |
| 69 | 69 |
| 70 // Move the cursor above the content again, which should trigger | 70 // Move the cursor above the content again, which should trigger |
| 71 // a javascript onMouseOut event. | 71 // a javascript onMouseOut event. |
| 72 ui_controls::SendMouseMove(above_content_point.x(), above_content_point.y()); | 72 ui_controls::SendMouseMove(above_content_point.x(), above_content_point.y()); |
| 73 | 73 |
| 74 // Wait on the correct final value of the cookie. | 74 // Wait on the correct final value of the cookie. |
| 75 string16 left_expected_title(ASCIIToUTF16("left")); | 75 string16 left_expected_title(ASCIIToUTF16("left")); |
| 76 ui_test_utils::TitleWatcher left_title_watcher(tab, left_expected_title); | 76 content::TitleWatcher left_title_watcher(tab, left_expected_title); |
| 77 EXPECT_EQ(left_expected_title, left_title_watcher.WaitAndGetTitle()); | 77 EXPECT_EQ(left_expected_title, left_title_watcher.WaitAndGetTitle()); |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace | 80 } // namespace |
| OLD | NEW |