Broke ContentSettingBubbleModelTest.Plugins on Android.
[chromium-blink-merge.git] / content / browser / web_contents / web_drag_source_mac_unittest.mm
bloba0f9b55baf63998496bfc0634910336e4594afc4
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
3 // found in the LICENSE file.
5 #import "content/browser/web_contents/web_drag_source_mac.h"
7 #include "content/browser/web_contents/web_contents_impl.h"
8 #include "content/public/test/test_renderer_host.h"
9 #include "googleurl/src/gurl.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "webkit/glue/webdropdata.h"
13 namespace content {
15 typedef RenderViewHostTestHarness WebDragSourceMacTest;
17 TEST_F(WebDragSourceMacTest, DragInvalidlyEscapedBookmarklet) {
18   scoped_ptr<WebContents> contents(CreateTestWebContents());
19   scoped_nsobject<NSView> view(
20       [[NSView alloc] initWithFrame:NSMakeRect(0, 0, 10, 10)]);
22   scoped_ptr<WebDropData> dropData(new WebDropData);
23   dropData->url = GURL("javascript:%");
25   WebContentsImpl* contentsImpl = static_cast<WebContentsImpl*>(contents.get());
26   scoped_nsobject<WebDragSource> source(
27       [[WebDragSource alloc]
28         initWithContents:contentsImpl
29                     view:view
30                 dropData:dropData.get()
31                    image:nil
32                   offset:NSMakePoint(0, 0)
33               pasteboard:[NSPasteboard pasteboardWithUniqueName]
34         dragOperationMask:NSDragOperationCopy]);
36   // Test that this call doesn't throw any exceptions: http://crbug.com/128371
37   scoped_nsobject<NSPasteboard> pasteboard(
38       [NSPasteboard pasteboardWithUniqueName]);
39   [source lazyWriteToPasteboard:pasteboard forType:NSURLPboardType];
42 }  // namespace content