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/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
9 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
10 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
11 #include "content/public/browser/web_contents_view.h" | 12 #include "content/public/browser/web_contents_view.h" |
12 #include "ui/ui_controls/ui_controls.h" | 13 #include "ui/ui_controls/ui_controls.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 class MouseLeaveTest : public InProcessBrowserTest { | 17 class MouseLeaveTest : public InProcessBrowserTest { |
17 public: | 18 public: |
18 MouseLeaveTest() {} | 19 MouseLeaveTest() {} |
19 | 20 |
20 DISALLOW_COPY_AND_ASSIGN(MouseLeaveTest); | 21 DISALLOW_COPY_AND_ASSIGN(MouseLeaveTest); |
21 }; | 22 }; |
22 | 23 |
23 #if defined(OS_MACOSX) | 24 #if defined(OS_MACOSX) |
24 // Missing automation provider support: http://crbug.com/45892 | 25 // Missing automation provider support: http://crbug.com/45892 |
25 #define MAYBE_TestOnMouseOut DISABLED_TestOnMouseOut | 26 #define MAYBE_TestOnMouseOut DISABLED_TestOnMouseOut |
26 #elif defined(OS_LINUX) | 27 #elif defined(OS_LINUX) |
27 // http://crbug.com/133361 | 28 // http://crbug.com/133361 |
28 #define MAYBE_TestOnMouseOut DISABLED_TestOnMouseOut | 29 #define MAYBE_TestOnMouseOut DISABLED_TestOnMouseOut |
29 #else | 30 #else |
30 #define MAYBE_TestOnMouseOut TestOnMouseOut | 31 #define MAYBE_TestOnMouseOut TestOnMouseOut |
31 #endif | 32 #endif |
32 | 33 |
33 IN_PROC_BROWSER_TEST_F(MouseLeaveTest, MAYBE_TestOnMouseOut) { | 34 IN_PROC_BROWSER_TEST_F(MouseLeaveTest, MAYBE_TestOnMouseOut) { |
34 GURL test_url = ui_test_utils::GetTestUrl( | 35 GURL test_url = ui_test_utils::GetTestUrl( |
35 FilePath(), FilePath(FILE_PATH_LITERAL("mouseleave.html"))); | 36 FilePath(), FilePath(FILE_PATH_LITERAL("mouseleave.html"))); |
36 | 37 |
37 content::WebContents* tab = browser()->GetActiveWebContents(); | 38 content::WebContents* tab = chrome::GetActiveWebContents(browser()); |
38 gfx::Rect tab_view_bounds; | 39 gfx::Rect tab_view_bounds; |
39 tab->GetView()->GetContainerBounds(&tab_view_bounds); | 40 tab->GetView()->GetContainerBounds(&tab_view_bounds); |
40 | 41 |
41 gfx::Point in_content_point( | 42 gfx::Point in_content_point( |
42 tab_view_bounds.x() + tab_view_bounds.width() / 2, | 43 tab_view_bounds.x() + tab_view_bounds.width() / 2, |
43 tab_view_bounds.y() + 10); | 44 tab_view_bounds.y() + 10); |
44 gfx::Point above_content_point( | 45 gfx::Point above_content_point( |
45 tab_view_bounds.x() + tab_view_bounds.width() / 2, | 46 tab_view_bounds.x() + tab_view_bounds.width() / 2, |
46 tab_view_bounds.y() - 2); | 47 tab_view_bounds.y() - 2); |
47 | 48 |
(...skipping 22 matching lines...) Expand all Loading... |
70 // a javascript onMouseOut event. | 71 // a javascript onMouseOut event. |
71 ui_controls::SendMouseMove(above_content_point.x(), above_content_point.y()); | 72 ui_controls::SendMouseMove(above_content_point.x(), above_content_point.y()); |
72 | 73 |
73 // Wait on the correct final value of the cookie. | 74 // Wait on the correct final value of the cookie. |
74 string16 left_expected_title(ASCIIToUTF16("left")); | 75 string16 left_expected_title(ASCIIToUTF16("left")); |
75 ui_test_utils::TitleWatcher left_title_watcher(tab, left_expected_title); | 76 ui_test_utils::TitleWatcher left_title_watcher(tab, left_expected_title); |
76 EXPECT_EQ(left_expected_title, left_title_watcher.WaitAndGetTitle()); | 77 EXPECT_EQ(left_expected_title, left_title_watcher.WaitAndGetTitle()); |
77 } | 78 } |
78 | 79 |
79 } // namespace | 80 } // namespace |
OLD | NEW |