OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 "content/renderer/webclipboard_impl.h" |
| 6 |
| 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "content/public/browser/web_contents.h" |
| 9 #include "content/public/test/browser_test_utils.h" |
| 10 #include "content/public/test/content_browser_test.h" |
| 11 #include "content/public/test/content_browser_test_utils.h" |
| 12 #include "content/shell/browser/shell.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 namespace { |
| 17 |
| 18 class WebClipboardImplTest : public ContentBrowserTest { |
| 19 public: |
| 20 WebClipboardImplTest() = default; |
| 21 ~WebClipboardImplTest() override = default; |
| 22 }; |
| 23 |
| 24 IN_PROC_BROWSER_TEST_F(WebClipboardImplTest, PasteRTF) { |
| 25 BrowserTestClipboardScope clipboard; |
| 26 |
| 27 const std::string rtf_content = "{\\rtf1\\ansi Hello, {\\b world.}}"; |
| 28 clipboard.SetRtf(rtf_content); |
| 29 |
| 30 // paste_listener.html takes RTF from the clipboard and sets the title. |
| 31 NavigateToURL(shell(), GetTestUrl(".", "paste_listener.html")); |
| 32 |
| 33 const base::string16 expected_title = base::UTF8ToUTF16(rtf_content); |
| 34 content::TitleWatcher title_watcher(shell()->web_contents(), expected_title); |
| 35 shell()->web_contents()->Paste(); |
| 36 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
| 37 } |
| 38 |
| 39 } |
| 40 |
| 41 } // namespace content |
OLD | NEW |