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

Side by Side Diff: content/browser/web_contents/web_drag_dest_mac_unittest.mm

Issue 121033002: Update uses of UTF conversions in content/ to use the base:: namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 12 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/mac/scoped_nsautorelease_pool.h" 5 #include "base/mac/scoped_nsautorelease_pool.h"
6 #import "base/mac/scoped_nsobject.h" 6 #import "base/mac/scoped_nsobject.h"
7 #include "base/strings/sys_string_conversions.h" 7 #include "base/strings/sys_string_conversions.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #import "content/browser/web_contents/web_drag_dest_mac.h" 9 #import "content/browser/web_contents/web_drag_dest_mac.h"
10 #include "content/public/common/drop_data.h" 10 #include "content/public/common/drop_data.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 url = @"/bin/sh"; 133 url = @"/bin/sh";
134 [pboard declareTypes:[NSArray arrayWithObject:NSFilenamesPboardType] 134 [pboard declareTypes:[NSArray arrayWithObject:NSFilenamesPboardType]
135 owner:nil]; 135 owner:nil];
136 [pboard setPropertyList:[NSArray arrayWithObject:url] 136 [pboard setPropertyList:[NSArray arrayWithObject:url]
137 forType:NSFilenamesPboardType]; 137 forType:NSFilenamesPboardType];
138 EXPECT_FALSE(ui::PopulateURLAndTitleFromPasteboard( 138 EXPECT_FALSE(ui::PopulateURLAndTitleFromPasteboard(
139 &result_url, &result_title, pboard, NO)); 139 &result_url, &result_title, pboard, NO));
140 EXPECT_TRUE(ui::PopulateURLAndTitleFromPasteboard( 140 EXPECT_TRUE(ui::PopulateURLAndTitleFromPasteboard(
141 &result_url, &result_title, pboard, YES)); 141 &result_url, &result_title, pboard, YES));
142 EXPECT_EQ("file://localhost/bin/sh", result_url.spec()); 142 EXPECT_EQ("file://localhost/bin/sh", result_url.spec());
143 EXPECT_EQ("sh", UTF16ToUTF8(result_title)); 143 EXPECT_EQ("sh", base::UTF16ToUTF8(result_title));
144 [pboard releaseGlobally]; 144 [pboard releaseGlobally];
145 } 145 }
146 146
147 TEST_F(WebDragDestTest, Data) { 147 TEST_F(WebDragDestTest, Data) {
148 DropData data; 148 DropData data;
149 NSPasteboard* pboard = [NSPasteboard pasteboardWithUniqueName]; 149 NSPasteboard* pboard = [NSPasteboard pasteboardWithUniqueName];
150 150
151 PutURLOnPasteboard(@"http://www.google.com", pboard); 151 PutURLOnPasteboard(@"http://www.google.com", pboard);
152 [pboard addTypes:[NSArray arrayWithObjects:NSHTMLPboardType, 152 [pboard addTypes:[NSArray arrayWithObjects:NSHTMLPboardType,
153 NSStringPboardType, nil] 153 NSStringPboardType, nil]
154 owner:nil]; 154 owner:nil];
155 NSString* htmlString = @"<html><body><b>hi there</b></body></html>"; 155 NSString* htmlString = @"<html><body><b>hi there</b></body></html>";
156 NSString* textString = @"hi there"; 156 NSString* textString = @"hi there";
157 [pboard setString:htmlString forType:NSHTMLPboardType]; 157 [pboard setString:htmlString forType:NSHTMLPboardType];
158 [pboard setString:textString forType:NSStringPboardType]; 158 [pboard setString:textString forType:NSStringPboardType];
159 [drag_dest_ populateDropData:&data fromPasteboard:pboard]; 159 [drag_dest_ populateDropData:&data fromPasteboard:pboard];
160 EXPECT_EQ(data.url.spec(), "http://www.google.com/"); 160 EXPECT_EQ(data.url.spec(), "http://www.google.com/");
161 EXPECT_EQ(base::SysNSStringToUTF16(textString), data.text.string()); 161 EXPECT_EQ(base::SysNSStringToUTF16(textString), data.text.string());
162 EXPECT_EQ(base::SysNSStringToUTF16(htmlString), data.html.string()); 162 EXPECT_EQ(base::SysNSStringToUTF16(htmlString), data.html.string());
163 163
164 [pboard releaseGlobally]; 164 [pboard releaseGlobally];
165 } 165 }
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_drag_dest_gtk.cc ('k') | content/browser/web_contents/web_drag_source_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698