| 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.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/cancelable_request.h" | 10 #include "chrome/browser/cancelable_request.h" |
| (...skipping 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 FindBarController::kKeepResultsInFindBox); | 1333 FindBarController::kKeepResultsInFindBox); |
| 1334 | 1334 |
| 1335 // Open a new incognito window and navigate to the same page. | 1335 // Open a new incognito window and navigate to the same page. |
| 1336 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); | 1336 Profile* incognito_profile = browser()->profile()->GetOffTheRecordProfile(); |
| 1337 Browser* incognito_browser = | 1337 Browser* incognito_browser = |
| 1338 new Browser(Browser::CreateParams(incognito_profile)); | 1338 new Browser(Browser::CreateParams(incognito_profile)); |
| 1339 content::WindowedNotificationObserver observer( | 1339 content::WindowedNotificationObserver observer( |
| 1340 content::NOTIFICATION_LOAD_STOP, | 1340 content::NOTIFICATION_LOAD_STOP, |
| 1341 content::NotificationService::AllSources()); | 1341 content::NotificationService::AllSources()); |
| 1342 chrome::AddSelectedTabWithURL(incognito_browser, url, | 1342 chrome::AddSelectedTabWithURL(incognito_browser, url, |
| 1343 content::PAGE_TRANSITION_START_PAGE); | 1343 content::PAGE_TRANSITION_AUTO_TOPLEVEL); |
| 1344 observer.Wait(); | 1344 observer.Wait(); |
| 1345 incognito_browser->window()->Show(); | 1345 incognito_browser->window()->Show(); |
| 1346 | 1346 |
| 1347 // Open the find box and make sure that it is prepopulated with "page". | 1347 // Open the find box and make sure that it is prepopulated with "page". |
| 1348 EnsureFindBoxOpenForBrowser(incognito_browser); | 1348 EnsureFindBoxOpenForBrowser(incognito_browser); |
| 1349 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(incognito_browser)); | 1349 EXPECT_EQ(ASCIIToUTF16("page"), GetFindBarTextForBrowser(incognito_browser)); |
| 1350 | 1350 |
| 1351 // Search for the word "text" in the incognito tab. | 1351 // Search for the word "text" in the incognito tab. |
| 1352 TabContents* incognito_tab = chrome::GetActiveTabContents(incognito_browser); | 1352 TabContents* incognito_tab = chrome::GetActiveTabContents(incognito_browser); |
| 1353 EXPECT_EQ(1, FindInPageWchar(incognito_tab, L"text", | 1353 EXPECT_EQ(1, FindInPageWchar(incognito_tab, L"text", |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1459 content::RunAllPendingInMessageLoop(); // Needed on Linux. | 1459 content::RunAllPendingInMessageLoop(); // Needed on Linux. |
| 1460 EXPECT_TRUE(GetFindBarWindowInfo(&position, NULL)); | 1460 EXPECT_TRUE(GetFindBarWindowInfo(&position, NULL)); |
| 1461 | 1461 |
| 1462 ui_test_utils::NavigateToURLWithDisposition( | 1462 ui_test_utils::NavigateToURLWithDisposition( |
| 1463 browser(), url, NEW_FOREGROUND_TAB, | 1463 browser(), url, NEW_FOREGROUND_TAB, |
| 1464 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 1464 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 1465 chrome::CloseTab(browser()); | 1465 chrome::CloseTab(browser()); |
| 1466 EXPECT_TRUE(GetFindBarWindowInfo(&position2, NULL)); | 1466 EXPECT_TRUE(GetFindBarWindowInfo(&position2, NULL)); |
| 1467 EXPECT_EQ(position, position2); | 1467 EXPECT_EQ(position, position2); |
| 1468 } | 1468 } |
| OLD | NEW |