OLD | NEW |
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 #include "content/browser/renderer_host/test_render_view_host.h" | 9 #include "content/browser/renderer_host/test_render_view_host.h" |
10 #import "content/browser/web_contents/web_drag_dest_mac.h" | 10 #import "content/browser/web_contents/web_drag_dest_mac.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // We can't put a value on the screen size since everyone will have a | 78 // We can't put a value on the screen size since everyone will have a |
79 // different one. | 79 // different one. |
80 EXPECT_NE(0, screenPoint.y); | 80 EXPECT_NE(0, screenPoint.y); |
81 } | 81 } |
82 | 82 |
83 TEST_F(WebDragDestTest, URL) { | 83 TEST_F(WebDragDestTest, URL) { |
84 NSPasteboard* pboard = nil; | 84 NSPasteboard* pboard = nil; |
85 NSString* url = nil; | 85 NSString* url = nil; |
86 NSString* title = nil; | 86 NSString* title = nil; |
87 GURL result_url; | 87 GURL result_url; |
88 string16 result_title; | 88 base::string16 result_title; |
89 | 89 |
90 // Put a URL on the pasteboard and check it. | 90 // Put a URL on the pasteboard and check it. |
91 pboard = [NSPasteboard pasteboardWithUniqueName]; | 91 pboard = [NSPasteboard pasteboardWithUniqueName]; |
92 url = @"http://www.google.com/"; | 92 url = @"http://www.google.com/"; |
93 PutURLOnPasteboard(url, pboard); | 93 PutURLOnPasteboard(url, pboard); |
94 EXPECT_TRUE(ui::PopulateURLAndTitleFromPasteboard( | 94 EXPECT_TRUE(ui::PopulateURLAndTitleFromPasteboard( |
95 &result_url, &result_title, pboard, NO)); | 95 &result_url, &result_title, pboard, NO)); |
96 EXPECT_EQ(base::SysNSStringToUTF8(url), result_url.spec()); | 96 EXPECT_EQ(base::SysNSStringToUTF8(url), result_url.spec()); |
97 [pboard releaseGlobally]; | 97 [pboard releaseGlobally]; |
98 | 98 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |