| 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/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.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/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 #define MAYBE_FindAndCopy FindAndCopy | 262 #define MAYBE_FindAndCopy FindAndCopy |
| 263 #endif | 263 #endif |
| 264 IN_PROC_BROWSER_TEST_F(PDFBrowserTest, MAYBE_FindAndCopy) { | 264 IN_PROC_BROWSER_TEST_F(PDFBrowserTest, MAYBE_FindAndCopy) { |
| 265 ASSERT_NO_FATAL_FAILURE(Load()); | 265 ASSERT_NO_FATAL_FAILURE(Load()); |
| 266 // Verifies that find in page works. | 266 // Verifies that find in page works. |
| 267 ASSERT_EQ(3, ui_test_utils::FindInPage( | 267 ASSERT_EQ(3, ui_test_utils::FindInPage( |
| 268 chrome::GetActiveTabContents(browser()), UTF8ToUTF16("adipiscing"), | 268 chrome::GetActiveTabContents(browser()), UTF8ToUTF16("adipiscing"), |
| 269 true, false, NULL, NULL)); | 269 true, false, NULL, NULL)); |
| 270 | 270 |
| 271 // Verify that copying selected text works. | 271 // Verify that copying selected text works. |
| 272 ui::Clipboard clipboard; | 272 ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); |
| 273 // Reset the clipboard first. | 273 // Reset the clipboard first. |
| 274 ui::Clipboard::ObjectMap objects; | 274 ui::Clipboard::ObjectMap objects; |
| 275 ui::Clipboard::ObjectMapParams params; | 275 ui::Clipboard::ObjectMapParams params; |
| 276 params.push_back(std::vector<char>()); | 276 params.push_back(std::vector<char>()); |
| 277 objects[ui::Clipboard::CBF_TEXT] = params; | 277 objects[ui::Clipboard::CBF_TEXT] = params; |
| 278 clipboard.WriteObjects(ui::Clipboard::BUFFER_STANDARD, objects); | 278 clipboard->WriteObjects(ui::Clipboard::BUFFER_STANDARD, objects); |
| 279 | 279 |
| 280 chrome::GetActiveWebContents(browser())->GetRenderViewHost()->Copy(); | 280 chrome::GetActiveWebContents(browser())->GetRenderViewHost()->Copy(); |
| 281 ASSERT_NO_FATAL_FAILURE(WaitForResponse()); | 281 ASSERT_NO_FATAL_FAILURE(WaitForResponse()); |
| 282 | 282 |
| 283 | |
| 284 std::string text; | 283 std::string text; |
| 285 clipboard.ReadAsciiText(ui::Clipboard::BUFFER_STANDARD, &text); | 284 clipboard->ReadAsciiText(ui::Clipboard::BUFFER_STANDARD, &text); |
| 286 ASSERT_EQ("adipiscing", text); | 285 ASSERT_EQ("adipiscing", text); |
| 287 } | 286 } |
| 288 | 287 |
| 289 // Tests that loading async pdfs works correctly (i.e. document fully loads). | 288 // Tests that loading async pdfs works correctly (i.e. document fully loads). |
| 290 // This also loads all documents that used to crash, to ensure we don't have | 289 // This also loads all documents that used to crash, to ensure we don't have |
| 291 // regressions. | 290 // regressions. |
| 292 // If it flakes, reopen http://crbug.com/74548. | 291 // If it flakes, reopen http://crbug.com/74548. |
| 293 IN_PROC_BROWSER_TEST_F(PDFBrowserTest, SLOW_Loading) { | 292 IN_PROC_BROWSER_TEST_F(PDFBrowserTest, SLOW_Loading) { |
| 294 ASSERT_TRUE(pdf_test_server()->Start()); | 293 ASSERT_TRUE(pdf_test_server()->Start()); |
| 295 | 294 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), | 389 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), |
| 391 std::wstring(), | 390 std::wstring(), |
| 392 L"reloadPDF();")); | 391 L"reloadPDF();")); |
| 393 observer.Wait(); | 392 observer.Wait(); |
| 394 | 393 |
| 395 ASSERT_EQ("success", | 394 ASSERT_EQ("success", |
| 396 chrome::GetActiveWebContents(browser())->GetURL().query()); | 395 chrome::GetActiveWebContents(browser())->GetURL().query()); |
| 397 } | 396 } |
| 398 | 397 |
| 399 } // namespace | 398 } // namespace |
| OLD | NEW |