| 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/process_util.h" | 5 #include "base/process_util.h" |
| 6 #include "base/string_util.h" | 6 #include "base/string_util.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
| 9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
| 10 #include "chrome/browser/ui/browser_tabstrip.h" | 10 #include "chrome/browser/ui/browser_tabstrip.h" |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); | 345 VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); |
| 346 | 346 |
| 347 // "a" should be selected. | 347 // "a" should be selected. |
| 348 EXPECT_EQ(ASCIIToUTF16("a"), GetFindBarSelectedText()); | 348 EXPECT_EQ(ASCIIToUTF16("a"), GetFindBarSelectedText()); |
| 349 | 349 |
| 350 // Press Ctrl-C to copy the content. | 350 // Press Ctrl-C to copy the content. |
| 351 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 351 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 352 browser(), ui::VKEY_C, true, false, false, false)); | 352 browser(), ui::VKEY_C, true, false, false, false)); |
| 353 | 353 |
| 354 string16 str; | 354 string16 str; |
| 355 views::ViewsDelegate::views_delegate->GetClipboard()-> | 355 ui::Clipboard::GetForCurrentThread()-> |
| 356 ReadText(ui::Clipboard::BUFFER_STANDARD, &str); | 356 ReadText(ui::Clipboard::BUFFER_STANDARD, &str); |
| 357 | 357 |
| 358 // Make sure the text is copied successfully. | 358 // Make sure the text is copied successfully. |
| 359 EXPECT_EQ(ASCIIToUTF16("a"), str); | 359 EXPECT_EQ(ASCIIToUTF16("a"), str); |
| 360 | 360 |
| 361 // Press Ctrl-V to paste the content back, it should start finding even if the | 361 // Press Ctrl-V to paste the content back, it should start finding even if the |
| 362 // content is not changed. | 362 // content is not changed. |
| 363 content::Source<WebContents> notification_source( | 363 content::Source<WebContents> notification_source( |
| 364 chrome::GetActiveWebContents(browser())); | 364 chrome::GetActiveWebContents(browser())); |
| 365 ui_test_utils::WindowedNotificationObserverWithDetails | 365 ui_test_utils::WindowedNotificationObserverWithDetails |
| 366 <FindNotificationDetails> observer( | 366 <FindNotificationDetails> observer( |
| 367 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, notification_source); | 367 chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, notification_source); |
| 368 | 368 |
| 369 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 369 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 370 browser(), ui::VKEY_V, true, false, false, false)); | 370 browser(), ui::VKEY_V, true, false, false, false)); |
| 371 | 371 |
| 372 ASSERT_NO_FATAL_FAILURE(observer.Wait()); | 372 ASSERT_NO_FATAL_FAILURE(observer.Wait()); |
| 373 FindNotificationDetails details; | 373 FindNotificationDetails details; |
| 374 ASSERT_TRUE(observer.GetDetailsFor(notification_source.map_key(), &details)); | 374 ASSERT_TRUE(observer.GetDetailsFor(notification_source.map_key(), &details)); |
| 375 EXPECT_TRUE(details.number_of_matches() > 0); | 375 EXPECT_TRUE(details.number_of_matches() > 0); |
| 376 } | 376 } |
| OLD | NEW |