Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: chrome/browser/ui/find_bar/find_bar_host_browsertest.cc

Issue 14307023: chrome: Use base::MessageLoop. (Part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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.h" 6 #include "base/message_loop.h"
7 #include "base/string16.h" 7 #include "base/string16.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/common/cancelable_request.h" 10 #include "chrome/browser/common/cancelable_request.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 62
63 const bool kBack = false; 63 const bool kBack = false;
64 const bool kFwd = true; 64 const bool kFwd = true;
65 65
66 const bool kIgnoreCase = false; 66 const bool kIgnoreCase = false;
67 const bool kCaseSensitive = true; 67 const bool kCaseSensitive = true;
68 68
69 const int kMoveIterations = 30; 69 const int kMoveIterations = 30;
70 70
71 void HistoryServiceQueried(int) { 71 void HistoryServiceQueried(int) {
72 MessageLoop::current()->Quit(); 72 base::MessageLoop::current()->Quit();
73 } 73 }
74 74
75 } // namespace 75 } // namespace
76 76
77 class FindInPageControllerTest : public InProcessBrowserTest { 77 class FindInPageControllerTest : public InProcessBrowserTest {
78 public: 78 public:
79 FindInPageControllerTest() { 79 FindInPageControllerTest() {
80 chrome::DisableFindBarAnimationsDuringTesting(true); 80 chrome::DisableFindBarAnimationsDuringTesting(true);
81 } 81 }
82 82
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 } 993 }
994 994
995 // Make sure Find box moves out of the way if it is obscuring the active match. 995 // Make sure Find box moves out of the way if it is obscuring the active match.
996 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindMovesWhenObscuring) { 996 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, FindMovesWhenObscuring) {
997 GURL url = GetURL(kMoveIfOver); 997 GURL url = GetURL(kMoveIfOver);
998 ui_test_utils::NavigateToURL(browser(), url); 998 ui_test_utils::NavigateToURL(browser(), url);
999 999
1000 chrome::ShowFindBar(browser()); 1000 chrome::ShowFindBar(browser());
1001 1001
1002 // This is needed on GTK because the reposition operation is asynchronous. 1002 // This is needed on GTK because the reposition operation is asynchronous.
1003 MessageLoop::current()->RunUntilIdle(); 1003 base::MessageLoop::current()->RunUntilIdle();
1004 1004
1005 gfx::Point start_position; 1005 gfx::Point start_position;
1006 gfx::Point position; 1006 gfx::Point position;
1007 bool fully_visible = false; 1007 bool fully_visible = false;
1008 int ordinal = 0; 1008 int ordinal = 0;
1009 1009
1010 // Make sure it is open. 1010 // Make sure it is open.
1011 EXPECT_TRUE(GetFindBarWindowInfo(&start_position, &fully_visible)); 1011 EXPECT_TRUE(GetFindBarWindowInfo(&start_position, &fully_visible));
1012 EXPECT_TRUE(fully_visible); 1012 EXPECT_TRUE(fully_visible);
1013 1013
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
1438 content::WindowedNotificationObserver observer( 1438 content::WindowedNotificationObserver observer(
1439 content::NOTIFICATION_LOAD_STOP, 1439 content::NOTIFICATION_LOAD_STOP,
1440 content::NotificationService::AllSources()); 1440 content::NotificationService::AllSources());
1441 chrome::AddSelectedTabWithURL(popup, GURL(chrome::kAboutBlankURL), 1441 chrome::AddSelectedTabWithURL(popup, GURL(chrome::kAboutBlankURL),
1442 content::PAGE_TRANSITION_LINK); 1442 content::PAGE_TRANSITION_LINK);
1443 // Wait for the page to finish loading. 1443 // Wait for the page to finish loading.
1444 observer.Wait(); 1444 observer.Wait();
1445 popup->window()->Show(); 1445 popup->window()->Show();
1446 1446
1447 // On GTK, bounds change is asynchronous. 1447 // On GTK, bounds change is asynchronous.
1448 MessageLoop::current()->RunUntilIdle(); 1448 base::MessageLoop::current()->RunUntilIdle();
1449 1449
1450 EnsureFindBoxOpenForBrowser(popup); 1450 EnsureFindBoxOpenForBrowser(popup);
1451 1451
1452 // GTK adjusts FindBar size asynchronously. 1452 // GTK adjusts FindBar size asynchronously.
1453 MessageLoop::current()->RunUntilIdle(); 1453 base::MessageLoop::current()->RunUntilIdle();
1454 1454
1455 ASSERT_LE(GetFindBarWidthForBrowser(popup), 1455 ASSERT_LE(GetFindBarWidthForBrowser(popup),
1456 popup->window()->GetBounds().width()); 1456 popup->window()->GetBounds().width());
1457 } 1457 }
1458 1458
1459 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest, 1459 IN_PROC_BROWSER_TEST_F(FindInPageControllerTest,
1460 FindMovesOnTabClose_Issue1343052) { 1460 FindMovesOnTabClose_Issue1343052) {
1461 EnsureFindBoxOpen(); 1461 EnsureFindBoxOpen();
1462 content::RunAllPendingInMessageLoop(); // Needed on Linux. 1462 content::RunAllPendingInMessageLoop(); // Needed on Linux.
1463 1463
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1542 browser()->tab_strip_model()->GetActiveWebContents(); 1542 browser()->tab_strip_model()->GetActiveWebContents();
1543 FindInPageWchar(web_contents_1, L"page", kFwd, kIgnoreCase, NULL); 1543 FindInPageWchar(web_contents_1, L"page", kFwd, kIgnoreCase, NULL);
1544 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarText()); 1544 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarText());
1545 WebContents* web_contents_2 = 1545 WebContents* web_contents_2 =
1546 browser_incognito->tab_strip_model()->GetActiveWebContents(); 1546 browser_incognito->tab_strip_model()->GetActiveWebContents();
1547 FindInPageWchar(web_contents_2, L"Incognito", kFwd, kIgnoreCase, NULL); 1547 FindInPageWchar(web_contents_2, L"Incognito", kFwd, kIgnoreCase, NULL);
1548 EXPECT_EQ(ASCIIToUTF16("Incognito"), 1548 EXPECT_EQ(ASCIIToUTF16("Incognito"),
1549 GetFindBarTextForBrowser(browser_incognito)); 1549 GetFindBarTextForBrowser(browser_incognito));
1550 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarText()); 1550 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarText());
1551 } 1551 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/extensions/app_metro_infobar_delegate_win.cc ('k') | chrome/browser/ui/fullscreen/fullscreen_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698