Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: content/renderer/webclipboard_impl_browsertest.cc

Issue 2146323002: Expose RTF content on the clipboard as strings to pages when pasting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: BrowserTestClipboardScope. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/renderer/webclipboard_impl.cc ('k') | content/test/data/paste_listener.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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
OLDNEW
« no previous file with comments | « content/renderer/webclipboard_impl.cc ('k') | content/test/data/paste_listener.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698