OLD | NEW |
| (Empty) |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "base/strings/utf_string_conversions.h" | |
6 #include "chrome/browser/ui/browser.h" | |
7 #include "chrome/browser/ui/pdf/pdf_browsertest_base.h" | |
8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | |
9 #include "chrome/test/base/ui_test_utils.h" | |
10 #include "content/public/browser/web_contents.h" | |
11 #include "ui/base/clipboard/clipboard.h" | |
12 | |
13 // Note: All tests in here require the internal PDF plugin, so they're disabled | |
14 // in non-official builds. We still compile them though, to prevent bitrot. | |
15 // | |
16 // These tests are interactive because they access the clipboard. | |
17 | |
18 namespace { | |
19 | |
20 const char kSearchKeyword[] = "adipiscing"; | |
21 | |
22 #if defined(GOOGLE_CHROME_BUILD) && (defined(OS_WIN) || defined(OS_LINUX)) | |
23 #define MAYBE_FindAndCopy DISABLED_FindAndCopy | |
24 #else | |
25 // TODO(thestig): http://crbug.com/79837, http://crbug.com/329912 | |
26 #define MAYBE_FindAndCopy DISABLED_FindAndCopy | |
27 #endif | |
28 IN_PROC_BROWSER_TEST_F(PDFBrowserTest, MAYBE_FindAndCopy) { | |
29 ASSERT_NO_FATAL_FAILURE(Load()); | |
30 // Verifies that find in page works. | |
31 ASSERT_EQ(3, ui_test_utils::FindInPage( | |
32 browser()->tab_strip_model()->GetActiveWebContents(), | |
33 base::ASCIIToUTF16(kSearchKeyword), | |
34 true, false, NULL, NULL)); | |
35 | |
36 // Verify that copying selected text works. | |
37 ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); | |
38 // Reset the clipboard first. | |
39 clipboard->Clear(ui::CLIPBOARD_TYPE_COPY_PASTE); | |
40 | |
41 browser()->tab_strip_model()->GetActiveWebContents()->Copy(); | |
42 ASSERT_NO_FATAL_FAILURE(WaitForResponse()); | |
43 | |
44 std::string text; | |
45 clipboard->ReadAsciiText(ui::CLIPBOARD_TYPE_COPY_PASTE, &text); | |
46 EXPECT_EQ(kSearchKeyword, text); | |
47 } | |
48 | |
49 } // namespace | |
OLD | NEW |