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

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: Use the IO thread on Windows. 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
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 BrowserTestClipboard clipboard;
26 clipboard.SetUp();
27
28 const std::string rtf_content = "{\\rtf1\\ansi Hello, {\\b world.}}";
29 clipboard.SetRtf(rtf_content);
30
31 // paste_listener.html takes RTF from the clipboard and sets the title.
32 NavigateToURL(shell(), GetTestUrl(".", "paste_listener.html"));
33
34 const base::string16 expected_title = base::UTF8ToUTF16(rtf_content);
35 content::TitleWatcher title_watcher(shell()->web_contents(), expected_title);
36 shell()->web_contents()->Paste();
37 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
38
39 clipboard.TearDown();
40 }
41
42 }
43
44 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698