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 <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 #include <tuple> | 7 #include <tuple> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 #include "third_party/WebKit/public/web/WebFrameContentDumper.h" | 73 #include "third_party/WebKit/public/web/WebFrameContentDumper.h" |
74 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" | 74 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" |
75 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 75 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
76 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 76 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
77 #include "third_party/WebKit/public/web/WebPerformance.h" | 77 #include "third_party/WebKit/public/web/WebPerformance.h" |
78 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" | 78 #include "third_party/WebKit/public/web/WebRuntimeFeatures.h" |
79 #include "third_party/WebKit/public/web/WebScriptSource.h" | 79 #include "third_party/WebKit/public/web/WebScriptSource.h" |
80 #include "third_party/WebKit/public/web/WebSettings.h" | 80 #include "third_party/WebKit/public/web/WebSettings.h" |
81 #include "third_party/WebKit/public/web/WebView.h" | 81 #include "third_party/WebKit/public/web/WebView.h" |
82 #include "third_party/WebKit/public/web/WebWindowFeatures.h" | 82 #include "third_party/WebKit/public/web/WebWindowFeatures.h" |
| 83 #include "ui/events/base_event_utils.h" |
83 #include "ui/events/event.h" | 84 #include "ui/events/event.h" |
84 #include "ui/events/keycodes/keyboard_codes.h" | 85 #include "ui/events/keycodes/keyboard_codes.h" |
85 #include "ui/gfx/codec/jpeg_codec.h" | 86 #include "ui/gfx/codec/jpeg_codec.h" |
86 #include "ui/gfx/range/range.h" | 87 #include "ui/gfx/range/range.h" |
87 #include "ui/native_theme/native_theme_switches.h" | 88 #include "ui/native_theme/native_theme_switches.h" |
88 | 89 |
89 #if defined(USE_AURA) && defined(USE_X11) | 90 #if defined(USE_AURA) && defined(USE_X11) |
90 #include <X11/Xlib.h> | 91 #include <X11/Xlib.h> |
91 #include "base/memory/ptr_util.h" | 92 #include "base/memory/ptr_util.h" |
92 #include "ui/events/event_constants.h" | 93 #include "ui/events/event_constants.h" |
(...skipping 1309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1402 view()->OnSetHistoryOffsetAndLength(1, 2); | 1403 view()->OnSetHistoryOffsetAndLength(1, 2); |
1403 EXPECT_EQ(2, view()->history_list_length_); | 1404 EXPECT_EQ(2, view()->history_list_length_); |
1404 EXPECT_EQ(1, view()->history_list_offset_); | 1405 EXPECT_EQ(1, view()->history_list_offset_); |
1405 } | 1406 } |
1406 | 1407 |
1407 TEST_F(RenderViewImplTest, ContextMenu) { | 1408 TEST_F(RenderViewImplTest, ContextMenu) { |
1408 LoadHTML("<div>Page A</div>"); | 1409 LoadHTML("<div>Page A</div>"); |
1409 | 1410 |
1410 // Create a right click in the center of the iframe. (I'm hoping this will | 1411 // Create a right click in the center of the iframe. (I'm hoping this will |
1411 // make this a bit more robust in case of some other formatting or other bug.) | 1412 // make this a bit more robust in case of some other formatting or other bug.) |
1412 WebMouseEvent mouse_event; | 1413 WebMouseEvent mouse_event(WebInputEvent::MouseDown, |
1413 mouse_event.type = WebInputEvent::MouseDown; | 1414 WebInputEvent::NoModifiers, |
| 1415 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); |
1414 mouse_event.button = WebMouseEvent::Button::Right; | 1416 mouse_event.button = WebMouseEvent::Button::Right; |
1415 mouse_event.x = 250; | 1417 mouse_event.x = 250; |
1416 mouse_event.y = 250; | 1418 mouse_event.y = 250; |
1417 mouse_event.globalX = 250; | 1419 mouse_event.globalX = 250; |
1418 mouse_event.globalY = 250; | 1420 mouse_event.globalY = 250; |
1419 | 1421 |
1420 SendWebMouseEvent(mouse_event); | 1422 SendWebMouseEvent(mouse_event); |
1421 | 1423 |
1422 // Now simulate the corresponding up event which should display the menu | 1424 // Now simulate the corresponding up event which should display the menu |
1423 mouse_event.type = WebInputEvent::MouseUp; | 1425 mouse_event.setType(WebInputEvent::MouseUp); |
1424 SendWebMouseEvent(mouse_event); | 1426 SendWebMouseEvent(mouse_event); |
1425 | 1427 |
1426 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( | 1428 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( |
1427 FrameHostMsg_ContextMenu::ID)); | 1429 FrameHostMsg_ContextMenu::ID)); |
1428 } | 1430 } |
1429 | 1431 |
1430 TEST_F(RenderViewImplTest, TestBackForward) { | 1432 TEST_F(RenderViewImplTest, TestBackForward) { |
1431 LoadHTML("<div id=pagename>Page A</div>"); | 1433 LoadHTML("<div id=pagename>Page A</div>"); |
1432 PageState page_a_state = GetCurrentPageState(); | 1434 PageState page_a_state = GetCurrentPageState(); |
1433 int was_page_a = -1; | 1435 int was_page_a = -1; |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2552 ExpectPauseAndResume(3); | 2554 ExpectPauseAndResume(3); |
2553 blink::WebScriptSource source2( | 2555 blink::WebScriptSource source2( |
2554 WebString::fromUTF8("function func2() { func1(); }; func2();")); | 2556 WebString::fromUTF8("function func2() { func1(); }; func2();")); |
2555 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); | 2557 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); |
2556 | 2558 |
2557 EXPECT_FALSE(IsPaused()); | 2559 EXPECT_FALSE(IsPaused()); |
2558 Detach(); | 2560 Detach(); |
2559 } | 2561 } |
2560 | 2562 |
2561 } // namespace content | 2563 } // namespace content |
OLD | NEW |