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

Unified Diff: chrome/common/os_exchange_data_unittest.cc

Issue 11247: Remove cf_html from webdropdata.h. This is windows (Closed)
Patch Set: fix feedback Created 12 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/os_exchange_data.cc ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/os_exchange_data_unittest.cc
diff --git a/chrome/common/os_exchange_data_unittest.cc b/chrome/common/os_exchange_data_unittest.cc
index f54cb722967d0b39cff108bcb210e8109eb621bc..427208fc76e5ac61068eee9df789e2970f8418d6 100644
--- a/chrome/common/os_exchange_data_unittest.cc
+++ b/chrome/common/os_exchange_data_unittest.cc
@@ -5,6 +5,7 @@
#include <atlbase.h>
#include <shlobj.h>
+#include "base/clipboard_util.h"
#include "base/pickle.h"
#include "base/ref_counted.h"
#include "base/scoped_handle.h"
@@ -313,16 +314,33 @@ TEST(OSExchangeDataTest, FileContents) {
TEST(OSExchangeDataTest, Html) {
scoped_refptr<OSExchangeData> data(new OSExchangeData);
- std::wstring html(L"Version:0.9\nStartHTML:71\nEndHTML:160\n"
- L"StartFragment:130\nEndFragment:150\n<HTML>\n<BODY>\n"
- L"<!--StartFragment-->\n<b>bold.</b> <i><b>This is bold italic.</b></i>\n"
- L"<!--EndFragment-->\n</BODY>\n</HTML>");
- data->SetCFHtml(html);
+ GURL url("http://www.google.com/");
+ std::wstring html(
+ L"<HTML>\n<BODY>\n"
+ L"<b>bold.</b> <i><b>This is bold italic.</b></i>\n"
+ L"</BODY>\n</HTML>");
+ data->SetHtml(html, url);
scoped_refptr<OSExchangeData> copy(new OSExchangeData(data.get()));
std::wstring read_html;
- EXPECT_TRUE(copy->GetCFHtml(&read_html));
+ EXPECT_TRUE(copy->GetHtml(&read_html, &url));
EXPECT_EQ(html, read_html);
+
+ // Check the CF_HTML too.
+ std::string expected_cf_html(
+ "Version:0.9\r\nStartHTML:0000000138\r\nEndHTML:0000000291\r\n"
+ "StartFragment:0000000176\r\nEndFragment:0000000253\r\n"
+ "SourceURL:http://www.google.com/\r\n<html>\r\n<body>\r\n"
+ "<!--StartFragment-->\r\n");
+ expected_cf_html += WideToUTF8(html);
+ expected_cf_html.append("\r\n<!--EndFragment-->\r\n</body>\r\n</html>");
+
+ STGMEDIUM medium;
+ EXPECT_EQ(S_OK, data->GetData(ClipboardUtil::GetHtmlFormat(), &medium));
+ ScopedHGlobal<char> glob(medium.hGlobal);
+ std::string output(glob.get(), glob.Size());
+ EXPECT_EQ(expected_cf_html, output);
+ ReleaseStgMedium(&medium);
}
TEST(OSExchangeDataTest, SetURLWithMaxPath) {
« no previous file with comments | « chrome/common/os_exchange_data.cc ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698