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

Side by Side Diff: Source/web/tests/WebFrameTest.cpp

Issue 727593003: Implement MouseEvent buttons attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 5480 matching lines...) Expand 10 before | Expand all | Expand 10 after
5491 registerMockedHttpURLLoad("fragment_middle_click.html"); 5491 registerMockedHttpURLLoad("fragment_middle_click.html");
5492 TestNavigationPolicyWebFrameClient client; 5492 TestNavigationPolicyWebFrameClient client;
5493 FrameTestHelpers::WebViewHelper webViewHelper; 5493 FrameTestHelpers::WebViewHelper webViewHelper;
5494 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr ue, &client); 5494 webViewHelper.initializeAndLoad(m_baseURL + "fragment_middle_click.html", tr ue, &client);
5495 5495
5496 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF rame())->document(); 5496 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF rame())->document();
5497 KURL destination = document->url(); 5497 KURL destination = document->url();
5498 destination.setFragmentIdentifier("test"); 5498 destination.setFragmentIdentifier("test");
5499 5499
5500 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click, false, false, 5500 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click, false, false,
5501 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, false, false, false, false, 1, nullptr, nullptr); 5501 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, false, false, false, false, 1, 0, nullptr, nullptr);
5502 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); 5502 FrameLoadRequest frameRequest(document, ResourceRequest(destination));
5503 frameRequest.setTriggeringEvent(event); 5503 frameRequest.setTriggeringEvent(event);
5504 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa d(frameRequest); 5504 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa d(frameRequest);
5505 } 5505 }
5506 5506
5507 class TestNewWindowWebViewClient : public FrameTestHelpers::TestWebViewClient { 5507 class TestNewWindowWebViewClient : public FrameTestHelpers::TestWebViewClient {
5508 public: 5508 public:
5509 virtual WebView* createView(WebLocalFrame*, const WebURLRequest&, const WebW indowFeatures&, 5509 virtual WebView* createView(WebLocalFrame*, const WebURLRequest&, const WebW indowFeatures&,
5510 const WebString&, WebNavigationPolicy, bool) override 5510 const WebString&, WebNavigationPolicy, bool) override
5511 { 5511 {
(...skipping 28 matching lines...) Expand all
5540 TestNewWindowWebViewClient webViewClient; 5540 TestNewWindowWebViewClient webViewClient;
5541 TestNewWindowWebFrameClient webFrameClient; 5541 TestNewWindowWebFrameClient webFrameClient;
5542 FrameTestHelpers::WebViewHelper webViewHelper; 5542 FrameTestHelpers::WebViewHelper webViewHelper;
5543 webViewHelper.initializeAndLoad(m_baseURL + "ctrl_click.html", true, &webFra meClient, &webViewClient); 5543 webViewHelper.initializeAndLoad(m_baseURL + "ctrl_click.html", true, &webFra meClient, &webViewClient);
5544 5544
5545 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF rame())->document(); 5545 Document* document = toLocalFrame(webViewHelper.webViewImpl()->page()->mainF rame())->document();
5546 KURL destination = toKURL(m_baseURL + "hello_world.html"); 5546 KURL destination = toKURL(m_baseURL + "hello_world.html");
5547 5547
5548 // ctrl+click event 5548 // ctrl+click event
5549 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click, false, false, 5549 RefPtrWillBeRawPtr<Event> event = MouseEvent::create(EventTypeNames::click, false, false,
5550 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, true, false, false, false, 0 , nullptr, nullptr); 5550 document->domWindow(), 0, 0, 0, 0, 0, 0, 0, true, false, false, false, 0 , 0, nullptr, nullptr);
5551 FrameLoadRequest frameRequest(document, ResourceRequest(destination)); 5551 FrameLoadRequest frameRequest(document, ResourceRequest(destination));
5552 frameRequest.setTriggeringEvent(event); 5552 frameRequest.setTriggeringEvent(event);
5553 UserGestureIndicator gesture(DefinitelyProcessingUserGesture); 5553 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
5554 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa d(frameRequest); 5554 toLocalFrame(webViewHelper.webViewImpl()->page()->mainFrame())->loader().loa d(frameRequest);
5555 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webView()->mainF rame()); 5555 FrameTestHelpers::pumpPendingRequestsDoNotUse(webViewHelper.webView()->mainF rame());
5556 5556
5557 // decidePolicyForNavigation should be called both for the original request and the ctrl+click. 5557 // decidePolicyForNavigation should be called both for the original request and the ctrl+click.
5558 EXPECT_EQ(2, webFrameClient.decidePolicyCallCount()); 5558 EXPECT_EQ(2, webFrameClient.decidePolicyCallCount());
5559 } 5559 }
5560 5560
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
6921 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); 6921 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount());
6922 6922
6923 // Neither should a page reload. 6923 // Neither should a page reload.
6924 localFrame->reload(); 6924 localFrame->reload();
6925 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); 6925 EXPECT_EQ(4u, frameClient.provisionalLoadCount());
6926 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); 6926 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition());
6927 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); 6927 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount());
6928 } 6928 }
6929 6929
6930 } // namespace 6930 } // namespace
OLDNEW
« Source/web/WebInputEventConversion.cpp ('K') | « Source/web/WebInputEventConversion.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698