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

Side by Side Diff: chrome/browser/tab_contents/web_drag_dest_gtk_unittest.cc

Issue 8196001: content: Split web_drag_dest_gtk.cc into chrome/ and content/ parts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: :( Created 9 years, 2 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
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
jam 2011/10/11 01:42:21 do we not care to test this stuff anymore? seems b
Elliot Glaysher 2011/10/11 17:53:57 This test checked for a case where the internals o
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/tab_contents/web_drag_dest_gtk.h"
6
7 #include <gtk/gtk.h>
8
9 #include <cstring>
10
11 #include "base/memory/scoped_ptr.h"
12 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
13 #include "content/browser/tab_contents/test_tab_contents.h"
14
15 class WebDragDestGtkTest : public ChromeRenderViewHostTestHarness {
16 public:
17 WebDragDestGtkTest() {}
18
19 private:
20 DISALLOW_COPY_AND_ASSIGN(WebDragDestGtkTest);
21 };
22
23 // Test that WebDragDestGtk doesn't crash when it gets drag events about a
24 // TabContents that doesn't have a corresponding TabContentsWrapper. See
25 // http;//crosbug.com/20738.
26 TEST_F(WebDragDestGtkTest, NoTabContentsWrapper) {
27 scoped_ptr<TestTabContents> tab_contents(CreateTestTabContents());
28 GtkWidget* widget = gtk_button_new();
29 g_object_ref_sink(widget);
30 scoped_ptr<WebDragDestGtk> drag_dest(
31 new WebDragDestGtk(tab_contents.get(), widget));
32
33 // This is completely bogus and results in "Gtk-CRITICAL **:
34 // gtk_drag_get_data: assertion `GDK_IS_DRAG_CONTEXT (context)' failed"
35 // messages. However, passing a correctly-typed GdkDragContext created with
36 // g_object_new() results in a segfault, presumably because it's missing state
37 // that GTK/GDK set up for real drags.
38 GdkDragContext context;
39 memset(&context, 0, sizeof(context));
40 drag_dest->OnDragMotion(widget, &context, 0, 0, 0); // x, y, time
41
42 // This is bogus too.
43 GtkSelectionData data;
44 memset(&data, 0, sizeof(data));
45 while (drag_dest->data_requests_ > 0) {
46 drag_dest->OnDragDataReceived(widget,
47 &context,
48 0, 0, // x, y
49 &data,
50 0, 0); // info, time
51 }
52
53 // The next motion event after receiving all of the requested data is what
54 // triggers the crash.
55 drag_dest->OnDragMotion(widget, &context, 0, 0, 0); // x, y, time
56
57 drag_dest.reset();
58 g_object_unref(widget);
59 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698