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 1379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 #define MAYBE_FitWindow FitWindow | 1390 #define MAYBE_FitWindow FitWindow |
1391 #endif | 1391 #endif |
1392 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_FitWindow) { | 1392 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, MAYBE_FitWindow) { |
1393 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile(), | 1393 Browser::CreateParams params(Browser::TYPE_POPUP, browser()->profile(), |
1394 browser()->host_desktop_type()); | 1394 browser()->host_desktop_type()); |
1395 params.initial_bounds = gfx::Rect(0, 0, 250, 500); | 1395 params.initial_bounds = gfx::Rect(0, 0, 250, 500); |
1396 Browser* popup = new Browser(params); | 1396 Browser* popup = new Browser(params); |
1397 content::WindowedNotificationObserver observer( | 1397 content::WindowedNotificationObserver observer( |
1398 content::NOTIFICATION_LOAD_STOP, | 1398 content::NOTIFICATION_LOAD_STOP, |
1399 content::NotificationService::AllSources()); | 1399 content::NotificationService::AllSources()); |
1400 chrome::AddSelectedTabWithURL(popup, GURL(content::kAboutBlankURL), | 1400 chrome::AddSelectedTabWithURL( |
1401 content::PAGE_TRANSITION_LINK); | 1401 popup, GURL(url::kAboutBlankURL), content::PAGE_TRANSITION_LINK); |
1402 // Wait for the page to finish loading. | 1402 // Wait for the page to finish loading. |
1403 observer.Wait(); | 1403 observer.Wait(); |
1404 popup->window()->Show(); | 1404 popup->window()->Show(); |
1405 | 1405 |
1406 // On GTK, bounds change is asynchronous. | 1406 // On GTK, bounds change is asynchronous. |
1407 base::MessageLoop::current()->RunUntilIdle(); | 1407 base::MessageLoop::current()->RunUntilIdle(); |
1408 | 1408 |
1409 EnsureFindBoxOpenForBrowser(popup); | 1409 EnsureFindBoxOpenForBrowser(popup); |
1410 | 1410 |
1411 // GTK adjusts FindBar size asynchronously. | 1411 // GTK adjusts FindBar size asynchronously. |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 HWND child = NULL; | 1600 HWND child = NULL; |
1601 EnumChildWindows(hwnd, EnumerateChildren,reinterpret_cast<LPARAM>(&child)); | 1601 EnumChildWindows(hwnd, EnumerateChildren,reinterpret_cast<LPARAM>(&child)); |
1602 | 1602 |
1603 RECT region_before, region_after; | 1603 RECT region_before, region_after; |
1604 int result = GetWindowRgnBox(child, ®ion_before); | 1604 int result = GetWindowRgnBox(child, ®ion_before); |
1605 ASSERT_EQ(result, SIMPLEREGION); | 1605 ASSERT_EQ(result, SIMPLEREGION); |
1606 | 1606 |
1607 // Create a new tab and open the find bar there. | 1607 // Create a new tab and open the find bar there. |
1608 chrome::NewTab(browser()); | 1608 chrome::NewTab(browser()); |
1609 browser()->tab_strip_model()->ActivateTabAt(1, true); | 1609 browser()->tab_strip_model()->ActivateTabAt(1, true); |
1610 ui_test_utils::NavigateToURL(browser(), GURL(content::kAboutBlankURL)); | 1610 ui_test_utils::NavigateToURL(browser(), GURL(url::kAboutBlankURL)); |
1611 | 1611 |
1612 EnsureFindBoxOpen(); | 1612 EnsureFindBoxOpen(); |
1613 | 1613 |
1614 // Now switch back to the original tab with the plugin and show the find bar. | 1614 // Now switch back to the original tab with the plugin and show the find bar. |
1615 browser()->tab_strip_model()->ActivateTabAt(0, true); | 1615 browser()->tab_strip_model()->ActivateTabAt(0, true); |
1616 EnsureFindBoxOpen(); | 1616 EnsureFindBoxOpen(); |
1617 | 1617 |
1618 result = GetWindowRgnBox(child, ®ion_after); | 1618 result = GetWindowRgnBox(child, ®ion_after); |
1619 if (result == NULLREGION) { | 1619 if (result == NULLREGION) { |
1620 // Depending on the browser window size, the plugin could be full covered. | 1620 // Depending on the browser window size, the plugin could be full covered. |
1621 return; | 1621 return; |
1622 } | 1622 } |
1623 | 1623 |
1624 if (result == COMPLEXREGION) { | 1624 if (result == COMPLEXREGION) { |
1625 // Complex region, by definition not equal to the initial region. | 1625 // Complex region, by definition not equal to the initial region. |
1626 return; | 1626 return; |
1627 } | 1627 } |
1628 | 1628 |
1629 ASSERT_EQ(result, SIMPLEREGION); | 1629 ASSERT_EQ(result, SIMPLEREGION); |
1630 bool rects_equal = | 1630 bool rects_equal = |
1631 region_before.left == region_after.left && | 1631 region_before.left == region_after.left && |
1632 region_before.top == region_after.top && | 1632 region_before.top == region_after.top && |
1633 region_before.right == region_after.right && | 1633 region_before.right == region_after.right && |
1634 region_before.bottom == region_after.bottom; | 1634 region_before.bottom == region_after.bottom; |
1635 ASSERT_FALSE(rects_equal); | 1635 ASSERT_FALSE(rects_equal); |
1636 } | 1636 } |
1637 | 1637 |
1638 #endif | 1638 #endif |
OLD | NEW |