OLD | NEW |
1 // Copyright (c) 2010 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/mac/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 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | 8 #include "chrome/browser/renderer_host/test/test_render_view_host.h" |
9 #include "chrome/browser/tab_contents/test_tab_contents.h" | 9 #include "chrome/browser/tab_contents/test_tab_contents.h" |
10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 10 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
11 #import "chrome/browser/ui/cocoa/web_drop_target.h" | 11 #import "chrome/browser/ui/cocoa/tab_contents/web_drop_target.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 |
16 class WebDropTargetTest : public RenderViewHostTestHarness { | 16 class WebDropTargetTest : public RenderViewHostTestHarness { |
17 public: | 17 public: |
18 virtual void SetUp() { | 18 virtual void SetUp() { |
19 RenderViewHostTestHarness::SetUp(); | 19 RenderViewHostTestHarness::SetUp(); |
20 CocoaTest::BootstrapCocoa(); | 20 CocoaTest::BootstrapCocoa(); |
21 drop_target_.reset([[WebDropTarget alloc] initWithTabContents:contents()]); | 21 drop_target_.reset([[WebDropTarget alloc] initWithTabContents:contents()]); |
(...skipping 135 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 |