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

Side by Side Diff: webkit/glue/context_menu_unittest.cc

Issue 200054: Hook up WebFrameClient, replacing many WebViewDelegate methods.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 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
« no previous file with comments | « webkit/glue/chromium_bridge_impl.cc ('k') | webkit/glue/cpp_bound_class_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 // Tests for displaying context menus in corner cases (and swallowing context 5 // Tests for displaying context menus in corner cases (and swallowing context
6 // menu events when appropriate) 6 // menu events when appropriate)
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 17 matching lines...) Expand all
28 iframes_data_dir_ = iframes_data_dir_.AppendASCII("iframes"); 28 iframes_data_dir_ = iframes_data_dir_.AppendASCII("iframes");
29 ASSERT_TRUE(file_util::PathExists(iframes_data_dir_)); 29 ASSERT_TRUE(file_util::PathExists(iframes_data_dir_));
30 } 30 }
31 31
32 FilePath iframes_data_dir_; 32 FilePath iframes_data_dir_;
33 }; 33 };
34 34
35 35
36 TEST_F(ContextMenuCapturing, ContextMenuCapturing) { 36 TEST_F(ContextMenuCapturing, ContextMenuCapturing) {
37 // Make sure we have no stored mouse event state 37 // Make sure we have no stored mouse event state
38 WebViewDelegate* raw_delegate = test_shell_->webView()->GetDelegate(); 38 TestWebViewDelegate* test_delegate = test_shell_->delegate();
39 TestWebViewDelegate* test_delegate = static_cast<TestWebViewDelegate*>(raw_del egate);
40 test_delegate->clear_captured_context_menu_events(); 39 test_delegate->clear_captured_context_menu_events();
41 EXPECT_EQ(0U, test_delegate->captured_context_menu_events().size()); 40 EXPECT_EQ(0U, test_delegate->captured_context_menu_events().size());
42 41
43 std::wstring test_url = GetTestURL(iframes_data_dir_, "testiframe.html"); 42 GURL test_url = GetTestURL(iframes_data_dir_, "testiframe.html");
44 test_shell_->LoadURL(test_url.c_str()); 43 test_shell_->LoadURL(test_url);
45 test_shell_->WaitTestFinished(); 44 test_shell_->WaitTestFinished();
46 45
47 // Create a right click in the center of the iframe. (I'm hoping this will 46 // Create a right click in the center of the iframe. (I'm hoping this will
48 // make this a bit more robust in case of some other formatting or other bug.) 47 // make this a bit more robust in case of some other formatting or other bug.)
49 WebMouseEvent mouse_event; 48 WebMouseEvent mouse_event;
50 mouse_event.type = WebInputEvent::MouseDown; 49 mouse_event.type = WebInputEvent::MouseDown;
51 mouse_event.button = WebMouseEvent::ButtonRight; 50 mouse_event.button = WebMouseEvent::ButtonRight;
52 mouse_event.x = 250; 51 mouse_event.x = 250;
53 mouse_event.y = 250; 52 mouse_event.y = 250;
54 mouse_event.globalX = 250; 53 mouse_event.globalX = 250;
55 mouse_event.globalY = 250; 54 mouse_event.globalY = 250;
56 55
57 WebView* webview = test_shell_->webView(); 56 WebView* webview = test_shell_->webView();
58 webview->handleInputEvent(mouse_event); 57 webview->handleInputEvent(mouse_event);
59 58
60 // Now simulate the corresponding up event which should display the menu 59 // Now simulate the corresponding up event which should display the menu
61 mouse_event.type = WebInputEvent::MouseUp; 60 mouse_event.type = WebInputEvent::MouseUp;
62 webview->handleInputEvent(mouse_event); 61 webview->handleInputEvent(mouse_event);
63 62
64 EXPECT_EQ(1U, test_delegate->captured_context_menu_events().size()); 63 EXPECT_EQ(1U, test_delegate->captured_context_menu_events().size());
65 } 64 }
OLDNEW
« no previous file with comments | « webkit/glue/chromium_bridge_impl.cc ('k') | webkit/glue/cpp_bound_class_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698