| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 | 6 |
| 7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "content/common/intents_messages.h" | 10 #include "content/common/intents_messages.h" |
| 11 #include "content/common/view_messages.h" | 11 #include "content/common/view_messages.h" |
| 12 #include "content/public/browser/native_web_keyboard_event.h" | 12 #include "content/public/browser/native_web_keyboard_event.h" |
| 13 #include "content/renderer/render_view_impl.h" | 13 #include "content/renderer/render_view_impl.h" |
| 14 #include "content/test/render_view_test.h" | 14 #include "content/test/render_view_test.h" |
| 15 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.
h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLError.
h" |
| 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentServiceInfo.
h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebIntentServiceInfo.
h" |
| 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 21 #include "ui/base/keycodes/keyboard_codes.h" | 21 #include "ui/base/keycodes/keyboard_codes.h" |
| 22 #include "ui/base/range/range.h" | 22 #include "ui/base/range/range.h" |
| 23 #include "ui/gfx/codec/jpeg_codec.h" | 23 #include "ui/gfx/codec/jpeg_codec.h" |
| 24 #include "webkit/glue/web_io_operators.h" | 24 #include "webkit/glue/web_io_operators.h" |
| 25 | 25 |
| 26 using WebKit::WebFrame; | 26 using WebKit::WebFrame; |
| 27 using WebKit::WebInputEvent; |
| 28 using WebKit::WebMouseEvent; |
| 27 using WebKit::WebString; | 29 using WebKit::WebString; |
| 28 using WebKit::WebTextDirection; | 30 using WebKit::WebTextDirection; |
| 29 using WebKit::WebURLError; | 31 using WebKit::WebURLError; |
| 30 | 32 |
| 31 class RenderViewImplTest : public content::RenderViewTest { | 33 class RenderViewImplTest : public content::RenderViewTest { |
| 32 public: | 34 public: |
| 33 RenderViewImpl* view() { | 35 RenderViewImpl* view() { |
| 34 return static_cast<RenderViewImpl*>(view_); | 36 return static_cast<RenderViewImpl*>(view_); |
| 35 } | 37 } |
| 36 }; | 38 }; |
| (...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1138 string16 type; | 1140 string16 type; |
| 1139 string16 href; | 1141 string16 href; |
| 1140 string16 title; | 1142 string16 title; |
| 1141 string16 disposition; | 1143 string16 disposition; |
| 1142 IntentsHostMsg_RegisterIntentService::Read( | 1144 IntentsHostMsg_RegisterIntentService::Read( |
| 1143 msg, &action, &type, &href, &title, &disposition); | 1145 msg, &action, &type, &href, &title, &disposition); |
| 1144 EXPECT_EQ(ASCIIToUTF16("a"), action); | 1146 EXPECT_EQ(ASCIIToUTF16("a"), action); |
| 1145 EXPECT_EQ(ASCIIToUTF16("t"), type); | 1147 EXPECT_EQ(ASCIIToUTF16("t"), type); |
| 1146 EXPECT_EQ(ASCIIToUTF16("title"), title); | 1148 EXPECT_EQ(ASCIIToUTF16("title"), title); |
| 1147 } | 1149 } |
| 1150 |
| 1151 TEST_F(RenderViewImplTest, ContextMenu) { |
| 1152 LoadHTML("<div>Page A</div>"); |
| 1153 |
| 1154 // Create a right click in the center of the iframe. (I'm hoping this will |
| 1155 // make this a bit more robust in case of some other formatting or other bug.) |
| 1156 WebMouseEvent mouse_event; |
| 1157 mouse_event.type = WebInputEvent::MouseDown; |
| 1158 mouse_event.button = WebMouseEvent::ButtonRight; |
| 1159 mouse_event.x = 250; |
| 1160 mouse_event.y = 250; |
| 1161 mouse_event.globalX = 250; |
| 1162 mouse_event.globalY = 250; |
| 1163 |
| 1164 SendWebMouseEvent(mouse_event); |
| 1165 |
| 1166 // Now simulate the corresponding up event which should display the menu |
| 1167 mouse_event.type = WebInputEvent::MouseUp; |
| 1168 SendWebMouseEvent(mouse_event); |
| 1169 |
| 1170 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( |
| 1171 ViewHostMsg_ContextMenu::ID)); |
| 1172 } |
| OLD | NEW |