| OLD | NEW |
| 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" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "webkit/api/public/WebView.h" |
| 13 #include "webkit/glue/webkit_glue.h" | 14 #include "webkit/glue/webkit_glue.h" |
| 14 #include "webkit/glue/webview.h" | |
| 15 #include "webkit/tools/test_shell/test_shell_test.h" | 15 #include "webkit/tools/test_shell/test_shell_test.h" |
| 16 | 16 |
| 17 using WebKit::WebInputEvent; | 17 using WebKit::WebInputEvent; |
| 18 using WebKit::WebMouseEvent; | 18 using WebKit::WebMouseEvent; |
| 19 using WebKit::WebView; |
| 19 | 20 |
| 20 // Right clicking inside on an iframe should produce a context menu | 21 // Right clicking inside on an iframe should produce a context menu |
| 21 class ContextMenuCapturing : public TestShellTest { | 22 class ContextMenuCapturing : public TestShellTest { |
| 22 protected: | 23 protected: |
| 23 void SetUp() { | 24 void SetUp() { |
| 24 TestShellTest::SetUp(); | 25 TestShellTest::SetUp(); |
| 25 | 26 |
| 26 iframes_data_dir_ = data_dir_; | 27 iframes_data_dir_ = data_dir_; |
| 27 iframes_data_dir_ = iframes_data_dir_.AppendASCII("test_shell"); | 28 iframes_data_dir_ = iframes_data_dir_.AppendASCII("test_shell"); |
| 28 iframes_data_dir_ = iframes_data_dir_.AppendASCII("iframes"); | 29 iframes_data_dir_ = iframes_data_dir_.AppendASCII("iframes"); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 55 | 56 |
| 56 WebView* webview = test_shell_->webView(); | 57 WebView* webview = test_shell_->webView(); |
| 57 webview->handleInputEvent(mouse_event); | 58 webview->handleInputEvent(mouse_event); |
| 58 | 59 |
| 59 // Now simulate the corresponding up event which should display the menu | 60 // Now simulate the corresponding up event which should display the menu |
| 60 mouse_event.type = WebInputEvent::MouseUp; | 61 mouse_event.type = WebInputEvent::MouseUp; |
| 61 webview->handleInputEvent(mouse_event); | 62 webview->handleInputEvent(mouse_event); |
| 62 | 63 |
| 63 EXPECT_EQ(1U, test_delegate->captured_context_menu_events().size()); | 64 EXPECT_EQ(1U, test_delegate->captured_context_menu_events().size()); |
| 64 } | 65 } |
| OLD | NEW |