diff options
Diffstat (limited to 'chromium/ui/base/clipboard')
-rw-r--r-- | chromium/ui/base/clipboard/clipboard_android.cc | 5 | ||||
-rw-r--r-- | chromium/ui/base/clipboard/clipboard_mac.mm | 34 | ||||
-rw-r--r-- | chromium/ui/base/clipboard/clipboard_util_mac.h | 70 | ||||
-rw-r--r-- | chromium/ui/base/clipboard/clipboard_util_mac.mm | 179 | ||||
-rw-r--r-- | chromium/ui/base/clipboard/clipboard_util_mac_unittest.mm | 99 | ||||
-rw-r--r-- | chromium/ui/base/clipboard/custom_data_helper.cc | 20 | ||||
-rw-r--r-- | chromium/ui/base/clipboard/custom_data_helper_unittest.cc | 8 |
7 files changed, 376 insertions, 39 deletions
diff --git a/chromium/ui/base/clipboard/clipboard_android.cc b/chromium/ui/base/clipboard/clipboard_android.cc index 47465b04813..86d86b5be1d 100644 --- a/chromium/ui/base/clipboard/clipboard_android.cc +++ b/chromium/ui/base/clipboard/clipboard_android.cc @@ -116,10 +116,9 @@ void ClipboardMap::CommitToAndroidClipboard() { ScopedJavaLocalRef<jstring> str = ConvertUTF8ToJavaString(env, map_[kPlainTextFormat].c_str()); DCHECK(str.obj()); - Java_Clipboard_setText(env, clipboard_manager_.obj(), str.obj()); } else { - Java_Clipboard_setText(env, clipboard_manager_.obj(), nullptr); + Java_Clipboard_clear(env, clipboard_manager_.obj()); NOTIMPLEMENTED(); } } @@ -128,7 +127,7 @@ void ClipboardMap::Clear() { JNIEnv* env = AttachCurrentThread(); base::AutoLock lock(lock_); map_.clear(); - Java_Clipboard_setText(env, clipboard_manager_.obj(), NULL); + Java_Clipboard_clear(env, clipboard_manager_.obj()); } // Add a key:jstr pair to map, but only if jstr is not null, and also diff --git a/chromium/ui/base/clipboard/clipboard_mac.mm b/chromium/ui/base/clipboard/clipboard_mac.mm index eb4fc21b11a..f3a4c434704 100644 --- a/chromium/ui/base/clipboard/clipboard_mac.mm +++ b/chromium/ui/base/clipboard/clipboard_mac.mm @@ -20,6 +20,7 @@ #include "skia/ext/skia_utils_mac.h" #import "third_party/mozilla/NSPasteboard+Utils.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "ui/base/clipboard/clipboard_util_mac.h" #include "ui/base/clipboard/custom_data_helper.h" #include "ui/gfx/canvas.h" #include "ui/gfx/geometry/size.h" @@ -29,9 +30,6 @@ namespace ui { namespace { -// Would be nice if this were in UTCoreTypes.h, but it isn't -NSString* const kUTTypeURLName = @"public.url-name"; - // Tells us if WebKit was the last to write to the pasteboard. There's no // actual data associated with this type. NSString* const kWebSmartPastePboardType = @"NeXT smart paste pasteboard type"; @@ -114,7 +112,7 @@ const Clipboard::FormatType& Clipboard::GetUrlWFormatType() { // static const Clipboard::FormatType& Clipboard::GetPlainTextFormatType() { - CR_DEFINE_STATIC_LOCAL(FormatType, type, (NSStringPboardType)); + CR_DEFINE_STATIC_LOCAL(FormatType, type, (NSPasteboardTypeString)); return type; } @@ -245,7 +243,7 @@ void ClipboardMac::ReadText(ClipboardType type, base::string16* result) const { DCHECK(CalledOnValidThread()); DCHECK_EQ(type, CLIPBOARD_TYPE_COPY_PASTE); NSPasteboard* pb = GetPasteboard(); - NSString* contents = [pb stringForType:NSStringPboardType]; + NSString* contents = [pb stringForType:NSPasteboardTypeString]; *result = base::SysNSStringToUTF16(contents); } @@ -255,7 +253,7 @@ void ClipboardMac::ReadAsciiText(ClipboardType type, DCHECK(CalledOnValidThread()); DCHECK_EQ(type, CLIPBOARD_TYPE_COPY_PASTE); NSPasteboard* pb = GetPasteboard(); - NSString* contents = [pb stringForType:NSStringPboardType]; + NSString* contents = [pb stringForType:NSPasteboardTypeString]; if (!contents) result->clear(); @@ -279,7 +277,7 @@ void ClipboardMac::ReadHTML(ClipboardType type, NSPasteboard* pb = GetPasteboard(); NSArray* supportedTypes = [NSArray arrayWithObjects:NSHTMLPboardType, NSRTFPboardType, - NSStringPboardType, + NSPasteboardTypeString, nil]; NSString* bestType = [pb availableTypeFromArray:supportedTypes]; if (bestType) { @@ -354,12 +352,12 @@ void ClipboardMac::ReadBookmark(base::string16* title, std::string* url) const { NSPasteboard* pb = GetPasteboard(); if (title) { - NSString* contents = [pb stringForType:kUTTypeURLName]; + NSString* contents = ClipboardUtil::GetTitleFromPasteboardURL(pb); *title = base::SysNSStringToUTF16(contents); } if (url) { - NSString* url_string = [[NSURL URLFromPasteboard:pb] absoluteString]; + NSString* url_string = ClipboardUtil::GetURLFromPasteboardURL(pb); if (!url_string) url->clear(); else @@ -393,8 +391,8 @@ void ClipboardMac::WriteText(const char* text_data, size_t text_len) { std::string text_str(text_data, text_len); NSString* text = base::SysUTF8ToNSString(text_str); NSPasteboard* pb = GetPasteboard(); - [pb addTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil]; - [pb setString:text forType:NSStringPboardType]; + [pb addTypes:[NSArray arrayWithObject:NSPasteboardTypeString] owner:nil]; + [pb setString:text forType:NSPasteboardTypeString]; } void ClipboardMac::WriteHTML(const char* markup_data, @@ -425,18 +423,10 @@ void ClipboardMac::WriteBookmark(const char* title_data, std::string url_str(url_data, url_len); NSString* url = base::SysUTF8ToNSString(url_str); - // TODO(playmobil): In the Windows version of this function, an HTML - // representation of the bookmark is also added to the clipboard, to support - // drag and drop of web shortcuts. I don't think we need to do this on the - // Mac, but we should double check later on. - NSURL* nsurl = [NSURL URLWithString:url]; - + base::scoped_nsobject<NSPasteboardItem> item( + ClipboardUtil::PasteboardItemFromUrl(url, title)); NSPasteboard* pb = GetPasteboard(); - // passing UTIs into the pasteboard methods is valid >= 10.5 - [pb addTypes:[NSArray arrayWithObjects:NSURLPboardType, kUTTypeURLName, nil] - owner:nil]; - [nsurl writeToPasteboard:pb]; - [pb setString:title forType:kUTTypeURLName]; + ui::ClipboardUtil::AddDataToPasteboard(pb, item); } void ClipboardMac::WriteBitmap(const SkBitmap& bitmap) { diff --git a/chromium/ui/base/clipboard/clipboard_util_mac.h b/chromium/ui/base/clipboard/clipboard_util_mac.h new file mode 100644 index 00000000000..1c4ff0ad99d --- /dev/null +++ b/chromium/ui/base/clipboard/clipboard_util_mac.h @@ -0,0 +1,70 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_MAC_H_ +#define UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_MAC_H_ + +#import <AppKit/AppKit.h> + +#include "base/mac/scoped_nsobject.h" +#include "base/memory/ref_counted.h" +#include "ui/base/ui_base_export.h" + +namespace ui { + +class UI_BASE_EXPORT UniquePasteboard + : public base::RefCounted<UniquePasteboard> { + public: + UniquePasteboard(); + + NSPasteboard* get() { return pasteboard_; } + + private: + friend class base::RefCounted<UniquePasteboard>; + ~UniquePasteboard(); + base::scoped_nsobject<NSPasteboard> pasteboard_; +}; + +class UI_BASE_EXPORT ClipboardUtil { + public: + // Returns an NSPasteboardItem that represents the given |url|. + // |url| must not be nil. + // If |title| is nil, |url| is used in its place. + static base::scoped_nsobject<NSPasteboardItem> PasteboardItemFromUrl( + NSString* url, + NSString* title); + + // Returns an NSPasteboardItem that represents the given |urls| and |titles|. + static base::scoped_nsobject<NSPasteboardItem> PasteboardItemFromUrls( + NSArray* urls, + NSArray* titles); + + // Returns an NSPasteboardItem that represents the given string. + // |string| must not be nil. + static base::scoped_nsobject<NSPasteboardItem> PasteboardItemFromString( + NSString* string); + + // Returns the title or url associated with a NSPasteboard which contains an + // url NSPasteboardItem. + static NSString* GetTitleFromPasteboardURL(NSPasteboard* pboard); + static NSString* GetURLFromPasteboardURL(NSPasteboard* pboard); + + // Returns the UTI of a pasteboard type. + static NSString* UTIForPasteboardType(NSString* type); + static NSString* UTIForWebURLsAndTitles(); + + // For each pasteboard type in |item| that is not in |pboard|, add the type + // and its associated data. + static void AddDataToPasteboard(NSPasteboard* pboard, NSPasteboardItem* item); + + // Returns whether the operation was succesful. On success, the two arrays are + // guaranteed to be equal length, and are populated with strings of |urls| and + // |titles|. + static bool URLsAndTitlesFromPasteboard(NSPasteboard* pboard, + NSArray** urls, + NSArray** titles); +}; +} + +#endif // UI_BASE_CLIPBOARD_CLIPBOARD_UTIL_MAC_H_ diff --git a/chromium/ui/base/clipboard/clipboard_util_mac.mm b/chromium/ui/base/clipboard/clipboard_util_mac.mm new file mode 100644 index 00000000000..7d0d774122c --- /dev/null +++ b/chromium/ui/base/clipboard/clipboard_util_mac.mm @@ -0,0 +1,179 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "ui/base/clipboard/clipboard_util_mac.h" + +#include "base/mac/foundation_util.h" +#include "base/mac/scoped_cftyperef.h" + +namespace { +NSString* const kWebURLsWithTitlesPboardType = @"WebURLsWithTitlesPboardType"; +NSString* const kCorePasteboardFlavorType_url = + @"CorePasteboardFlavorType 0x75726C20"; // 'url ' url +NSString* const kCorePasteboardFlavorType_urln = + @"CorePasteboardFlavorType 0x75726C6E"; // 'urln' title + +// It's much more convenient to return an NSString than a +// base::ScopedCFTypeRef<CFStringRef>, since the methods on NSPasteboardItem +// require an NSString*. +NSString* UTIFromPboardType(NSString* type) { + return [base::mac::CFToNSCast(UTTypeCreatePreferredIdentifierForTag( + kUTTagClassNSPboardType, base::mac::NSToCFCast(type), kUTTypeData)) + autorelease]; +} +} // namespace + +namespace ui { + +UniquePasteboard::UniquePasteboard() + : pasteboard_([[NSPasteboard pasteboardWithUniqueName] retain]) {} + +UniquePasteboard::~UniquePasteboard() { + [pasteboard_ releaseGlobally]; +} + +// static +base::scoped_nsobject<NSPasteboardItem> ClipboardUtil::PasteboardItemFromUrl( + NSString* urlString, + NSString* title) { + DCHECK(urlString); + if (!title) + title = urlString; + + base::scoped_nsobject<NSPasteboardItem> item([[NSPasteboardItem alloc] init]); + + NSURL* url = [NSURL URLWithString:urlString]; + if ([url isFileURL] && + [[NSFileManager defaultManager] fileExistsAtPath:[url path]]) { + [item setPropertyList:@[ [url path] ] + forType:UTIFromPboardType(NSFilenamesPboardType)]; + } + + // Set Safari's URL + title arrays Pboard type. + NSArray* urlsAndTitles = @[ @[ urlString ], @[ title ] ]; + [item setPropertyList:urlsAndTitles + forType:UTIFromPboardType(kWebURLsWithTitlesPboardType)]; + + // Set NSURLPboardType. The format of the property list is divined from + // Webkit's function PlatformPasteboard::setStringForType. + // https://github.com/WebKit/webkit/blob/master/Source/WebCore/platform/mac/PlatformPasteboardMac.mm + NSURL* base = [url baseURL]; + if (base) { + [item setPropertyList:@[ [url relativeString], [base absoluteString] ] + forType:UTIFromPboardType(NSURLPboardType)]; + } else if (url) { + [item setPropertyList:@[ [url absoluteString], @"" ] + forType:UTIFromPboardType(NSURLPboardType)]; + } + + [item setString:urlString forType:NSPasteboardTypeString]; + + [item setData:[urlString dataUsingEncoding:NSUTF8StringEncoding] + forType:UTIFromPboardType(kCorePasteboardFlavorType_url)]; + + [item setData:[title dataUsingEncoding:NSUTF8StringEncoding] + forType:UTIFromPboardType(kCorePasteboardFlavorType_urln)]; + return item; +} + +// static +base::scoped_nsobject<NSPasteboardItem> ClipboardUtil::PasteboardItemFromUrls( + NSArray* urls, + NSArray* titles) { + base::scoped_nsobject<NSPasteboardItem> item([[NSPasteboardItem alloc] init]); + + // Set Safari's URL + title arrays Pboard type. + NSArray* urlsAndTitles = @[ urls, titles ]; + [item setPropertyList:urlsAndTitles + forType:UTIFromPboardType(kWebURLsWithTitlesPboardType)]; + + return item; +} + +// static +base::scoped_nsobject<NSPasteboardItem> ClipboardUtil::PasteboardItemFromString( + NSString* string) { + base::scoped_nsobject<NSPasteboardItem> item([[NSPasteboardItem alloc] init]); + [item setString:string forType:NSPasteboardTypeString]; + return item; +} + +//static +NSString* ClipboardUtil::GetTitleFromPasteboardURL(NSPasteboard* pboard) { + return + [pboard stringForType:UTIFromPboardType(kCorePasteboardFlavorType_urln)]; +} + +//static +NSString* ClipboardUtil::GetURLFromPasteboardURL(NSPasteboard* pboard) { + return + [pboard stringForType:UTIFromPboardType(kCorePasteboardFlavorType_url)]; +} + +// static +NSString* ClipboardUtil::UTIForPasteboardType(NSString* type) { + return UTIFromPboardType(type); +} + +// static +NSString* ClipboardUtil::UTIForWebURLsAndTitles() { + return UTIFromPboardType(kWebURLsWithTitlesPboardType); +} + +// static +void ClipboardUtil::AddDataToPasteboard(NSPasteboard* pboard, + NSPasteboardItem* item) { + NSSet* oldTypes = [NSSet setWithArray:[pboard types]]; + NSMutableSet* newTypes = [NSMutableSet setWithArray:[item types]]; + [newTypes minusSet:oldTypes]; + + [pboard addTypes:[newTypes allObjects] owner:nil]; + for (NSString* type in newTypes) { + // Technically, the object associated with |type| might be an NSString or a + // property list. It doesn't matter though, since the type gets pulled from + // and shoved into an NSDictionary. + [pboard setData:[item dataForType:type] forType:type]; + } +} + +// static +bool ClipboardUtil::URLsAndTitlesFromPasteboard(NSPasteboard* pboard, + NSArray** urls, + NSArray** titles) { + NSArray* bookmarkPairs = base::mac::ObjCCast<NSArray>([pboard + propertyListForType:UTIFromPboardType(kWebURLsWithTitlesPboardType)]); + if (!bookmarkPairs) + return false; + + if ([bookmarkPairs count] != 2) + return false; + + NSArray* urlsArr = + base::mac::ObjCCast<NSArray>([bookmarkPairs objectAtIndex:0]); + NSArray* titlesArr = + base::mac::ObjCCast<NSArray>([bookmarkPairs objectAtIndex:1]); + + if (!urlsArr || !titlesArr) + return false; + if ([urlsArr count] < 1) + return false; + if ([urlsArr count] != [titlesArr count]) + return false; + + for (id obj in urlsArr) { + if (![obj isKindOfClass:[NSString class]]) + return false; + } + + for (id obj in titlesArr) { + if (![obj isKindOfClass:[NSString class]]) + return false; + } + + *urls = urlsArr; + *titles = titlesArr; + return true; +} + +} // namespace ui diff --git a/chromium/ui/base/clipboard/clipboard_util_mac_unittest.mm b/chromium/ui/base/clipboard/clipboard_util_mac_unittest.mm new file mode 100644 index 00000000000..28728c2e9bc --- /dev/null +++ b/chromium/ui/base/clipboard/clipboard_util_mac_unittest.mm @@ -0,0 +1,99 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import "ui/base/clipboard/clipboard_util_mac.h" + +#include "base/mac/scoped_nsobject.h" +#include "base/memory/ref_counted.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "testing/gtest_mac.h" +#include "testing/platform_test.h" +#include "third_party/mozilla/NSPasteboard+Utils.h" + +namespace { + +class ClipboardUtilMacTest : public PlatformTest { + public: + ClipboardUtilMacTest() { } +}; + +TEST_F(ClipboardUtilMacTest, PasteboardItemFromUrl) { + NSString* urlString = + @"https://www.google.com/" + @"search?q=test&oq=test&aqs=chrome..69i57l2j69i60l4.278j0j7&" + @"sourceid=chrome&ie=UTF-8"; + + base::scoped_nsobject<NSPasteboardItem> item( + ui::ClipboardUtil::PasteboardItemFromUrl(urlString, nil)); + scoped_refptr<ui::UniquePasteboard> pasteboard = new ui::UniquePasteboard; + [pasteboard->get() writeObjects:@[ item ]]; + + NSArray* urls = nil; + NSArray* titles = nil; + [pasteboard->get() getURLs:&urls andTitles:&titles convertingFilenames:NO]; + + ASSERT_EQ(1u, [urls count]); + EXPECT_NSEQ(urlString, [urls objectAtIndex:0]); + ASSERT_EQ(1u, [titles count]); + EXPECT_NSEQ(urlString, [titles objectAtIndex:0]); + + NSURL* url = [NSURL URLFromPasteboard:pasteboard->get()]; + EXPECT_NSEQ([url absoluteString], urlString); +} + +TEST_F(ClipboardUtilMacTest, PasteboardItemWithTitle) { + NSString* urlString = @"https://www.google.com/"; + NSString* title = @"Burrowing Yams"; + + base::scoped_nsobject<NSPasteboardItem> item( + ui::ClipboardUtil::PasteboardItemFromUrl(urlString, title)); + scoped_refptr<ui::UniquePasteboard> pasteboard = new ui::UniquePasteboard; + [pasteboard->get() writeObjects:@[ item ]]; + + NSArray* urls = nil; + NSArray* titles = nil; + [pasteboard->get() getURLs:&urls andTitles:&titles convertingFilenames:NO]; + + ASSERT_EQ(1u, [urls count]); + EXPECT_NSEQ(urlString, [urls objectAtIndex:0]); + ASSERT_EQ(1u, [titles count]); + EXPECT_NSEQ(title, [titles objectAtIndex:0]); + + NSURL* url = [NSURL URLFromPasteboard:pasteboard->get()]; + EXPECT_NSEQ([url absoluteString], urlString); +} + +TEST_F(ClipboardUtilMacTest, PasteboardItemWithFilePath) { + NSURL* url = [NSURL fileURLWithPath:NSTemporaryDirectory() isDirectory:YES]; + ASSERT_TRUE(url); + NSString* urlString = [url absoluteString]; + + base::scoped_nsobject<NSPasteboardItem> item( + ui::ClipboardUtil::PasteboardItemFromUrl(urlString, nil)); + scoped_refptr<ui::UniquePasteboard> pasteboard = new ui::UniquePasteboard; + [pasteboard->get() writeObjects:@[ item ]]; + + NSArray* urls = nil; + NSArray* titles = nil; + [pasteboard->get() getURLs:&urls andTitles:&titles convertingFilenames:NO]; + + ASSERT_EQ(1u, [urls count]); + EXPECT_NSEQ(urlString, [urls objectAtIndex:0]); + ASSERT_EQ(1u, [titles count]); + EXPECT_NSEQ(urlString, [titles objectAtIndex:0]); + + NSURL* urlFromPasteboard = [NSURL URLFromPasteboard:pasteboard->get()]; + EXPECT_NSEQ(urlFromPasteboard, url); +} + +TEST_F(ClipboardUtilMacTest, CheckForLeak) { + for (int i = 0; i < 10000; ++i) { + @autoreleasepool { + scoped_refptr<ui::UniquePasteboard> pboard = new ui::UniquePasteboard; + EXPECT_TRUE(pboard->get()); + } + } +} + +} // namespace diff --git a/chromium/ui/base/clipboard/custom_data_helper.cc b/chromium/ui/base/clipboard/custom_data_helper.cc index a50a0a072c7..e67829a3107 100644 --- a/chromium/ui/base/clipboard/custom_data_helper.cc +++ b/chromium/ui/base/clipboard/custom_data_helper.cc @@ -43,8 +43,8 @@ void ReadCustomDataTypes(const void* data, SkippablePickle pickle(data, data_length); base::PickleIterator iter(pickle); - size_t size = 0; - if (!iter.ReadSizeT(&size)) + uint32_t size = 0; + if (!iter.ReadUInt32(&size)) return; // Keep track of the original elements in the types vector. On failure, we @@ -52,7 +52,7 @@ void ReadCustomDataTypes(const void* data, // custom data pickles. size_t original_size = types->size(); - for (size_t i = 0; i < size; ++i) { + for (uint32_t i = 0; i < size; ++i) { types->push_back(base::string16()); if (!iter.ReadString16(&types->back()) || !pickle.SkipString16(&iter)) { types->resize(original_size); @@ -68,11 +68,11 @@ void ReadCustomDataForType(const void* data, SkippablePickle pickle(data, data_length); base::PickleIterator iter(pickle); - size_t size = 0; - if (!iter.ReadSizeT(&size)) + uint32_t size = 0; + if (!iter.ReadUInt32(&size)) return; - for (size_t i = 0; i < size; ++i) { + for (uint32_t i = 0; i < size; ++i) { base::string16 deserialized_type; if (!iter.ReadString16(&deserialized_type)) return; @@ -91,11 +91,11 @@ void ReadCustomDataIntoMap(const void* data, base::Pickle pickle(reinterpret_cast<const char*>(data), data_length); base::PickleIterator iter(pickle); - size_t size = 0; - if (!iter.ReadSizeT(&size)) + uint32_t size = 0; + if (!iter.ReadUInt32(&size)) return; - for (size_t i = 0; i < size; ++i) { + for (uint32_t i = 0; i < size; ++i) { base::string16 type; if (!iter.ReadString16(&type)) { // Data is corrupt, return an empty map. @@ -115,7 +115,7 @@ void ReadCustomDataIntoMap(const void* data, void WriteCustomDataToPickle( const std::map<base::string16, base::string16>& data, base::Pickle* pickle) { - pickle->WriteSizeT(data.size()); + pickle->WriteUInt32(data.size()); for (std::map<base::string16, base::string16>::const_iterator it = data.begin(); it != data.end(); diff --git a/chromium/ui/base/clipboard/custom_data_helper_unittest.cc b/chromium/ui/base/clipboard/custom_data_helper_unittest.cc index 1ed53c66750..4d515476559 100644 --- a/chromium/ui/base/clipboard/custom_data_helper_unittest.cc +++ b/chromium/ui/base/clipboard/custom_data_helper_unittest.cc @@ -120,7 +120,7 @@ TEST(CustomDataHelperTest, BadReadTypes) { expected.push_back(ASCIIToUTF16("f")); base::Pickle malformed; - malformed.WriteSizeT(1000); + malformed.WriteUInt32(1000); malformed.WriteString16(ASCIIToUTF16("hello")); malformed.WriteString16(ASCIIToUTF16("world")); std::vector<base::string16> actual(expected); @@ -128,7 +128,7 @@ TEST(CustomDataHelperTest, BadReadTypes) { EXPECT_EQ(expected, actual); base::Pickle malformed2; - malformed2.WriteSizeT(1); + malformed2.WriteUInt32(1); malformed2.WriteString16(ASCIIToUTF16("hello")); std::vector<base::string16> actual2(expected); ReadCustomDataTypes(malformed2.data(), malformed2.size(), &actual2); @@ -140,7 +140,7 @@ TEST(CustomDataHelperTest, BadPickle) { std::map<base::string16, base::string16> result_map; base::Pickle malformed; - malformed.WriteSizeT(1000); + malformed.WriteUInt32(1000); malformed.WriteString16(ASCIIToUTF16("hello")); malformed.WriteString16(ASCIIToUTF16("world")); @@ -153,7 +153,7 @@ TEST(CustomDataHelperTest, BadPickle) { EXPECT_EQ(0u, result_map.size()); base::Pickle malformed2; - malformed2.WriteSizeT(1); + malformed2.WriteUInt32(1); malformed2.WriteString16(ASCIIToUTF16("hello")); ReadCustomDataForType(malformed2.data(), |