| OLD | NEW |
| 1 // Copyright (c) 2009 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 "base/scoped_nsautorelease_pool.h" | 5 #include "base/mac/scoped_nsautorelease_pool.h" |
| 6 #include "base/sys_string_conversions.h" | 6 #include "base/sys_string_conversions.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 8 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
| 9 #import "chrome/browser/cocoa/web_drop_target.h" | 9 #import "chrome/browser/cocoa/web_drop_target.h" |
| 10 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | 10 #include "chrome/browser/renderer_host/test/test_render_view_host.h" |
| 11 #include "chrome/browser/tab_contents/test_tab_contents.h" | 11 #include "chrome/browser/tab_contents/test_tab_contents.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #import "third_party/mozilla/NSPasteboard+Utils.h" | 13 #import "third_party/mozilla/NSPasteboard+Utils.h" |
| 14 #include "webkit/glue/webdropdata.h" | 14 #include "webkit/glue/webdropdata.h" |
| 15 | 15 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 35 declareTypes:[NSArray arrayWithObjects:kCorePasteboardFlavorType_url, | 35 declareTypes:[NSArray arrayWithObjects:kCorePasteboardFlavorType_url, |
| 36 kCorePasteboardFlavorType_urln, | 36 kCorePasteboardFlavorType_urln, |
| 37 nil] | 37 nil] |
| 38 owner:nil]; | 38 owner:nil]; |
| 39 [pboard setString:urlString | 39 [pboard setString:urlString |
| 40 forType:kCorePasteboardFlavorType_url]; | 40 forType:kCorePasteboardFlavorType_url]; |
| 41 [pboard setString:title | 41 [pboard setString:title |
| 42 forType:kCorePasteboardFlavorType_urln]; | 42 forType:kCorePasteboardFlavorType_urln]; |
| 43 } | 43 } |
| 44 | 44 |
| 45 base::ScopedNSAutoreleasePool pool_; | 45 base::mac::ScopedNSAutoreleasePool pool_; |
| 46 scoped_nsobject<WebDropTarget> drop_target_; | 46 scoped_nsobject<WebDropTarget> drop_target_; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 // Make sure nothing leaks. | 49 // Make sure nothing leaks. |
| 50 TEST_F(WebDropTargetTest, Init) { | 50 TEST_F(WebDropTargetTest, Init) { |
| 51 EXPECT_TRUE(drop_target_); | 51 EXPECT_TRUE(drop_target_); |
| 52 } | 52 } |
| 53 | 53 |
| 54 // Test flipping of coordinates given a point in window coordinates. | 54 // Test flipping of coordinates given a point in window coordinates. |
| 55 TEST_F(WebDropTargetTest, Flip) { | 55 TEST_F(WebDropTargetTest, Flip) { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 NSString* textString = @"hi there"; | 157 NSString* textString = @"hi there"; |
| 158 [pboard setString:htmlString forType:NSHTMLPboardType]; | 158 [pboard setString:htmlString forType:NSHTMLPboardType]; |
| 159 [pboard setString:textString forType:NSStringPboardType]; | 159 [pboard setString:textString forType:NSStringPboardType]; |
| 160 [drop_target_ populateWebDropData:&data fromPasteboard:pboard]; | 160 [drop_target_ populateWebDropData:&data fromPasteboard:pboard]; |
| 161 EXPECT_EQ(data.url.spec(), "http://www.google.com/"); | 161 EXPECT_EQ(data.url.spec(), "http://www.google.com/"); |
| 162 EXPECT_EQ(base::SysNSStringToUTF16(textString), data.plain_text); | 162 EXPECT_EQ(base::SysNSStringToUTF16(textString), data.plain_text); |
| 163 EXPECT_EQ(base::SysNSStringToUTF16(htmlString), data.text_html); | 163 EXPECT_EQ(base::SysNSStringToUTF16(htmlString), data.text_html); |
| 164 | 164 |
| 165 [pboard releaseGlobally]; | 165 [pboard releaseGlobally]; |
| 166 } | 166 } |
| OLD | NEW |