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 "ui/events/event_constants.h" | 92 #include "ui/events/event_constants.h" |
92 #include "ui/events/keycodes/keyboard_code_conversion.h" | 93 #include "ui/events/keycodes/keyboard_code_conversion.h" |
(...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1401 view()->OnSetHistoryOffsetAndLength(1, 2); | 1402 view()->OnSetHistoryOffsetAndLength(1, 2); |
1402 EXPECT_EQ(2, view()->history_list_length_); | 1403 EXPECT_EQ(2, view()->history_list_length_); |
1403 EXPECT_EQ(1, view()->history_list_offset_); | 1404 EXPECT_EQ(1, view()->history_list_offset_); |
1404 } | 1405 } |
1405 | 1406 |
1406 TEST_F(RenderViewImplTest, ContextMenu) { | 1407 TEST_F(RenderViewImplTest, ContextMenu) { |
1407 LoadHTML("<div>Page A</div>"); | 1408 LoadHTML("<div>Page A</div>"); |
1408 | 1409 |
1409 // Create a right click in the center of the iframe. (I'm hoping this will | 1410 // Create a right click in the center of the iframe. (I'm hoping this will |
1410 // make this a bit more robust in case of some other formatting or other bug.) | 1411 // make this a bit more robust in case of some other formatting or other bug.) |
1411 WebMouseEvent mouse_event; | 1412 WebMouseEvent mouse_event(WebInputEvent::MouseDown, |
1412 mouse_event.type = WebInputEvent::MouseDown; | 1413 WebInputEvent::NoModifiers, |
| 1414 ui::EventTimeStampToSeconds(ui::EventTimeForNow())); |
1413 mouse_event.button = WebMouseEvent::Button::Right; | 1415 mouse_event.button = WebMouseEvent::Button::Right; |
1414 mouse_event.x = 250; | 1416 mouse_event.x = 250; |
1415 mouse_event.y = 250; | 1417 mouse_event.y = 250; |
1416 mouse_event.globalX = 250; | 1418 mouse_event.globalX = 250; |
1417 mouse_event.globalY = 250; | 1419 mouse_event.globalY = 250; |
1418 | 1420 |
1419 SendWebMouseEvent(mouse_event); | 1421 SendWebMouseEvent(mouse_event); |
1420 | 1422 |
1421 // Now simulate the corresponding up event which should display the menu | 1423 // Now simulate the corresponding up event which should display the menu |
1422 mouse_event.type = WebInputEvent::MouseUp; | 1424 mouse_event.setType(WebInputEvent::MouseUp); |
1423 SendWebMouseEvent(mouse_event); | 1425 SendWebMouseEvent(mouse_event); |
1424 | 1426 |
1425 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( | 1427 EXPECT_TRUE(render_thread_->sink().GetUniqueMessageMatching( |
1426 FrameHostMsg_ContextMenu::ID)); | 1428 FrameHostMsg_ContextMenu::ID)); |
1427 } | 1429 } |
1428 | 1430 |
1429 TEST_F(RenderViewImplTest, TestBackForward) { | 1431 TEST_F(RenderViewImplTest, TestBackForward) { |
1430 LoadHTML("<div id=pagename>Page A</div>"); | 1432 LoadHTML("<div id=pagename>Page A</div>"); |
1431 PageState page_a_state = GetCurrentPageState(); | 1433 PageState page_a_state = GetCurrentPageState(); |
1432 int was_page_a = -1; | 1434 int was_page_a = -1; |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2551 ExpectPauseAndResume(3); | 2553 ExpectPauseAndResume(3); |
2552 blink::WebScriptSource source2( | 2554 blink::WebScriptSource source2( |
2553 WebString::fromUTF8("function func2() { func1(); }; func2();")); | 2555 WebString::fromUTF8("function func2() { func1(); }; func2();")); |
2554 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); | 2556 frame()->GetWebFrame()->executeScriptInIsolatedWorld(17, &source2, 1, 1); |
2555 | 2557 |
2556 EXPECT_FALSE(IsPaused()); | 2558 EXPECT_FALSE(IsPaused()); |
2557 Detach(); | 2559 Detach(); |
2558 } | 2560 } |
2559 | 2561 |
2560 } // namespace content | 2562 } // namespace content |
OLD | NEW |