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_util.h" | 5 #include "base/file_util.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 1364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1375 EXPECT_EQ(ordinal, 1); | 1375 EXPECT_EQ(ordinal, 1); |
1376 | 1376 |
1377 // End the find session, click on the link. | 1377 // End the find session, click on the link. |
1378 content::WindowedNotificationObserver observer( | 1378 content::WindowedNotificationObserver observer( |
1379 content::NOTIFICATION_LOAD_STOP, | 1379 content::NOTIFICATION_LOAD_STOP, |
1380 content::Source<NavigationController>(&web_contents->GetController())); | 1380 content::Source<NavigationController>(&web_contents->GetController())); |
1381 find_tab_helper->StopFinding(FindBarController::kActivateSelectionOnPage); | 1381 find_tab_helper->StopFinding(FindBarController::kActivateSelectionOnPage); |
1382 observer.Wait(); | 1382 observer.Wait(); |
1383 } | 1383 } |
1384 | 1384 |
1385 // Tests that FindBar fits within a narrow browser window. | 1385 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FitWindow) { |
1386 // Flaky on Linux/GTK: http://crbug.com/136443. | |
1387 #if defined(TOOLKIT_GTK) | |
1388 #define MAYBE_FitWindow DISABLED_FitWindow | |
1389 #else | |
1390 #define MAYBE_FitWindow FitWindow | |
1391 #endif | |
1392 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_FitWindow) { | |
1393 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile(), | 1386 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile(), |
1394 browser()->host_desktop_type()); | 1387 browser()->host_desktop_type()); |
1395 params.initial_bounds = gfx::Rect(0, 0, 250, 500); | 1388 params.initial_bounds = gfx::Rect(0, 0, 250, 500); |
1396 Browser* popup = new Browser(params); | 1389 Browser* popup = new Browser(params); |
1397 content::WindowedNotificationObserver observer( | 1390 content::WindowedNotificationObserver observer( |
1398 content::NOTIFICATION_LOAD_STOP, | 1391 content::NOTIFICATION_LOAD_STOP, |
1399 content::NotificationService::AllSources()); | 1392 content::NotificationService::AllSources()); |
1400 chrome::AddSelectedTabWithURL( | 1393 chrome::AddSelectedTabWithURL( |
1401 popup, GURL(url::kAboutBlankURL), content::PAGE_TRANSITION_LINK); | 1394 popup, GURL(url::kAboutBlankURL), content::PAGE_TRANSITION_LINK); |
1402 // Wait for the page to finish loading. | 1395 // Wait for the page to finish loading. |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1591 GURL url = ui_test_utils::GetTestUrl( | 1584 GURL url = ui_test_utils::GetTestUrl( |
1592 base::FilePath().AppendASCII("printing"), | 1585 base::FilePath().AppendASCII("printing"), |
1593 base::FilePath().AppendASCII("npapi_plugin.html")); | 1586 base::FilePath().AppendASCII("npapi_plugin.html")); |
1594 ui_test_utils::NavigateToURL(browser(), url); | 1587 ui_test_utils::NavigateToURL(browser(), url); |
1595 | 1588 |
1596 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 1589 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
1597 | 1590 |
1598 // Now get the region of the plugin before the find bar is shown. | 1591 // Now get the region of the plugin before the find bar is shown. |
1599 HWND hwnd = tab->GetNativeView()->GetHost()->GetAcceleratedWidget(); | 1592 HWND hwnd = tab->GetNativeView()->GetHost()->GetAcceleratedWidget(); |
1600 HWND child = NULL; | 1593 HWND child = NULL; |
1601 EnumChildWindows(hwnd, EnumerateChildren,reinterpret_cast<LPARAM>(&child)); | 1594 EnumChildWindows(hwnd, EnumerateChildren, reinterpret_cast<LPARAM>(&child)); |
1602 | 1595 |
1603 RECT region_before, region_after; | 1596 RECT region_before, region_after; |
1604 int result = GetWindowRgnBox(child, ®ion_before); | 1597 int result = GetWindowRgnBox(child, ®ion_before); |
1605 ASSERT_EQ(result, SIMPLEREGION); | 1598 ASSERT_EQ(result, SIMPLEREGION); |
1606 | 1599 |
1607 // Create a new tab and open the find bar there. | 1600 // Create a new tab and open the find bar there. |
1608 chrome::NewTab(browser()); | 1601 chrome::NewTab(browser()); |
1609 browser()->tab_strip_model()->ActivateTabAt(1, true); | 1602 browser()->tab_strip_model()->ActivateTabAt(1, true); |
1610 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); | 1603 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); |
1611 | 1604 |
(...skipping 17 matching lines...) Expand all Loading... |
1629 ASSERT_EQ(result, SIMPLEREGION); | 1622 ASSERT_EQ(result, SIMPLEREGION); |
1630 bool rects_equal = | 1623 bool rects_equal = |
1631 region_before.left == region_after.left && | 1624 region_before.left == region_after.left && |
1632 region_before.top == region_after.top && | 1625 region_before.top == region_after.top && |
1633 region_before.right == region_after.right && | 1626 region_before.right == region_after.right && |
1634 region_before.bottom == region_after.bottom; | 1627 region_before.bottom == region_after.bottom; |
1635 ASSERT_FALSE(rects_equal); | 1628 ASSERT_FALSE(rects_equal); |
1636 } | 1629 } |
1637 | 1630 |
1638 #endif | 1631 #endif |
OLD | NEW |