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/files/file_util.h" | 5 #include "base/files/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 1317 matching lines...) Loading... |
1328 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); | 1328 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); |
1329 Browser* incognito_browser = | 1329 Browser* incognito_browser = |
1330 new Browser(Browser::CreateParams(incognito_profile, | 1330 new Browser(Browser::CreateParams(incognito_profile, |
1331 browser()->host_desktop_type())); | 1331 browser()->host_desktop_type())); |
1332 content::WindowedNotificationObserver observer( | 1332 content::WindowedNotificationObserver observer( |
1333 content::NOTIFICATION_LOAD_STOP, | 1333 content::NOTIFICATION_LOAD_STOP, |
1334 content::NotificationService::AllSources()); | 1334 content::NotificationService::AllSources()); |
1335 chrome::AddSelectedTabWithURL(incognito_browser, url, | 1335 chrome::AddSelectedTabWithURL(incognito_browser, url, |
1336 ui::PAGE_TRANSITION_AUTO_TOPLEVEL); | 1336 ui::PAGE_TRANSITION_AUTO_TOPLEVEL); |
1337 observer.Wait(); | 1337 observer.Wait(); |
1338 incognito_browser->window()->Show(); | 1338 incognito_browser->window()->Show(false /* user_gesture */); |
1339 | 1339 |
1340 // Open the find box and make sure that it is prepopulated with "page". | 1340 // Open the find box and make sure that it is prepopulated with "page". |
1341 EnsureFindBoxOpenForBrowser(incognito_browser); | 1341 EnsureFindBoxOpenForBrowser(incognito_browser); |
1342 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(incognito_browser)); | 1342 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(incognito_browser)); |
1343 | 1343 |
1344 // Search for the word "text" in the incognito tab. | 1344 // Search for the word "text" in the incognito tab. |
1345 WebContents* incognito_tab = | 1345 WebContents* incognito_tab = |
1346 incognito_browser->tab_strip_model()->GetActiveWebContents(); | 1346 incognito_browser->tab_strip_model()->GetActiveWebContents(); |
1347 EXPECT_EQ(1, FindInPageASCII(incognito_tab, "text", | 1347 EXPECT_EQ(1, FindInPageASCII(incognito_tab, "text", |
1348 kFwd, kIgnoreCase, &ordinal)); | 1348 kFwd, kIgnoreCase, &ordinal)); |
(...skipping 44 matching lines...) Loading... |
1393 browser()->host_desktop_type()); | 1393 browser()->host_desktop_type()); |
1394 params.initial_bounds = gfx::Rect(0, 0, 250, 500); | 1394 params.initial_bounds = gfx::Rect(0, 0, 250, 500); |
1395 Browser* popup = new Browser(params); | 1395 Browser* popup = new Browser(params); |
1396 content::WindowedNotificationObserver observer( | 1396 content::WindowedNotificationObserver observer( |
1397 content::NOTIFICATION_LOAD_STOP, | 1397 content::NOTIFICATION_LOAD_STOP, |
1398 content::NotificationService::AllSources()); | 1398 content::NotificationService::AllSources()); |
1399 chrome::AddSelectedTabWithURL( | 1399 chrome::AddSelectedTabWithURL( |
1400 popup, GURL(url::kAboutBlankURL), ui::PAGE_TRANSITION_LINK); | 1400 popup, GURL(url::kAboutBlankURL), ui::PAGE_TRANSITION_LINK); |
1401 // Wait for the page to finish loading. | 1401 // Wait for the page to finish loading. |
1402 observer.Wait(); | 1402 observer.Wait(); |
1403 popup->window()->Show(); | 1403 popup->window()->Show(false /* user_gesture */); |
1404 | 1404 |
1405 // On GTK, bounds change is asynchronous. | 1405 // On GTK, bounds change is asynchronous. |
1406 base::MessageLoop::current()->RunUntilIdle(); | 1406 base::MessageLoop::current()->RunUntilIdle(); |
1407 | 1407 |
1408 EnsureFindBoxOpenForBrowser(popup); | 1408 EnsureFindBoxOpenForBrowser(popup); |
1409 | 1409 |
1410 // GTK adjusts FindBar size asynchronously. | 1410 // GTK adjusts FindBar size asynchronously. |
1411 base::MessageLoop::current()->RunUntilIdle(); | 1411 base::MessageLoop::current()->RunUntilIdle(); |
1412 | 1412 |
1413 ASSERT_LE(GetFindBarWidthForBrowser(popup), | 1413 ASSERT_LE(GetFindBarWidthForBrowser(popup), |
(...skipping 144 matching lines...) Loading... |
1558 | 1558 |
1559 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT)); | 1559 EXPECT_TRUE(chrome::ExecuteCommand(browser_incognito, IDC_FIND_NEXT)); |
1560 WebContents* web_contents_incognito = | 1560 WebContents* web_contents_incognito = |
1561 browser_incognito->tab_strip_model()->GetActiveWebContents(); | 1561 browser_incognito->tab_strip_model()->GetActiveWebContents(); |
1562 ui_test_utils::FindInPageNotificationObserver observer( | 1562 ui_test_utils::FindInPageNotificationObserver observer( |
1563 web_contents_incognito); | 1563 web_contents_incognito); |
1564 observer.Wait(); | 1564 observer.Wait(); |
1565 EXPECT_EQ(ASCIIToUTF16("bar"), | 1565 EXPECT_EQ(ASCIIToUTF16("bar"), |
1566 GetFindBarTextForBrowser(browser_incognito)); | 1566 GetFindBarTextForBrowser(browser_incognito)); |
1567 } | 1567 } |
OLD | NEW |