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

Side by Side Diff: webkit/tools/test_shell/mock_webclipboard_impl.cc

Issue 6635003: Support event.clipboardData.types in layout tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « webkit/tools/test_shell/mock_webclipboard_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "webkit/tools/test_shell/mock_webclipboard_impl.h" 5 #include "webkit/tools/test_shell/mock_webclipboard_impl.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "net/base/escape.h" 9 #include "net/base/escape.h"
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h" 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebImage.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h" 11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURL.h"
12 #include "webkit/glue/webclipboard_impl.h" 12 #include "webkit/glue/webclipboard_impl.h"
13 #include "webkit/glue/webkit_glue.h" 13 #include "webkit/glue/webkit_glue.h"
14 14
15 using WebKit::WebString; 15 using WebKit::WebString;
16 using WebKit::WebURL; 16 using WebKit::WebURL;
17 using WebKit::WebVector;
17 18
18 bool MockWebClipboardImpl::isFormatAvailable(Format format, Buffer buffer) { 19 bool MockWebClipboardImpl::isFormatAvailable(Format format, Buffer buffer) {
19 switch (format) { 20 switch (format) {
20 case FormatHTML: 21 case FormatHTML:
21 return !m_htmlText.isEmpty(); 22 return !m_htmlText.isEmpty();
22 23
23 case FormatSmartPaste: 24 case FormatSmartPaste:
24 return m_writeSmartPaste; 25 return m_writeSmartPaste;
25 26
26 default: 27 default:
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 79
79 void MockWebClipboardImpl::writeImage(const WebKit::WebImage& image, 80 void MockWebClipboardImpl::writeImage(const WebKit::WebImage& image,
80 const WebKit::WebURL& url, const WebKit::WebString& title) { 81 const WebKit::WebURL& url, const WebKit::WebString& title) {
81 if (!image.isNull()) { 82 if (!image.isNull()) {
82 m_htmlText = WebString::fromUTF8( 83 m_htmlText = WebString::fromUTF8(
83 webkit_glue::WebClipboardImpl::URLToImageMarkup(url, title)); 84 webkit_glue::WebClipboardImpl::URLToImageMarkup(url, title));
84 m_plainText = m_htmlText; 85 m_plainText = m_htmlText;
85 m_writeSmartPaste = false; 86 m_writeSmartPaste = false;
86 } 87 }
87 } 88 }
89
90 WebVector<WebString> MockWebClipboardImpl::readAvailableTypes(
91 Buffer buffer, bool* containsFilenames) {
92 *containsFilenames = false;
93 std::vector<WebString> results;
94 if (!m_plainText.isEmpty()) {
95 results.push_back(WebString("Text"));
96 results.push_back(WebString("text/plain"));
97 }
98 if (!m_htmlText.isEmpty()) {
99 results.push_back(WebString("text/html"));
100 }
101 return results;
102 }
OLDNEW
« no previous file with comments | « webkit/tools/test_shell/mock_webclipboard_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698