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

Side by Side Diff: chrome/browser/referrer_policy_browsertest.cc

Issue 2569273002: Add constructors to WebInputEvents and setters so we can work at cleaning up these public structs. (Closed)
Patch Set: Fix mouse up event sender not modifying modifiers Created 4 years 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 // 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/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 content::WebContents* tab = 170 content::WebContents* tab =
171 browser()->tab_strip_model()->GetActiveWebContents(); 171 browser()->tab_strip_model()->GetActiveWebContents();
172 content::TitleWatcher title_watcher(tab, expected_title); 172 content::TitleWatcher title_watcher(tab, expected_title);
173 173
174 // Watch for all possible outcomes to avoid timeouts if something breaks. 174 // Watch for all possible outcomes to avoid timeouts if something breaks.
175 AddAllPossibleTitles(start_url, &title_watcher); 175 AddAllPossibleTitles(start_url, &title_watcher);
176 176
177 ui_test_utils::NavigateToURL(browser(), start_url); 177 ui_test_utils::NavigateToURL(browser(), start_url);
178 178
179 if (button != blink::WebMouseEvent::Button::NoButton) { 179 if (button != blink::WebMouseEvent::Button::NoButton) {
180 blink::WebMouseEvent mouse_event; 180 blink::WebMouseEvent mouse_event(
181 mouse_event.type = blink::WebInputEvent::MouseDown; 181 blink::WebInputEvent::MouseDown, blink::WebInputEvent::NoModifiers,
182 blink::WebInputEvent::TimeStampForTesting);
182 mouse_event.button = button; 183 mouse_event.button = button;
183 mouse_event.x = 15; 184 mouse_event.x = 15;
184 mouse_event.y = 15; 185 mouse_event.y = 15;
185 mouse_event.clickCount = 1; 186 mouse_event.clickCount = 1;
186 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); 187 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event);
187 mouse_event.type = blink::WebInputEvent::MouseUp; 188 mouse_event.setType(blink::WebInputEvent::MouseUp);
188 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event); 189 tab->GetRenderViewHost()->GetWidget()->ForwardMouseEvent(mouse_event);
189 } 190 }
190 191
191 if (disposition == WindowOpenDisposition::CURRENT_TAB) { 192 if (disposition == WindowOpenDisposition::CURRENT_TAB) {
192 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); 193 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle());
193 } else { 194 } else {
194 tab_added_observer.Wait(); 195 tab_added_observer.Wait();
195 tab = tab_added_observer.GetTab(); 196 tab = tab_added_observer.GetTab();
196 EXPECT_TRUE(tab); 197 EXPECT_TRUE(tab);
197 content::TitleWatcher title_watcher2(tab, expected_title); 198 content::TitleWatcher title_watcher2(tab, expected_title);
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 HttpLeftClickRedirectDefaultFlag) { 614 HttpLeftClickRedirectDefaultFlag) {
614 blink::WebReferrerPolicy expected_referrer_policy = 615 blink::WebReferrerPolicy expected_referrer_policy =
615 blink::WebReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin; 616 blink::WebReferrerPolicyNoReferrerWhenDowngradeOriginWhenCrossOrigin;
616 617
617 RunReferrerTest(blink::WebReferrerPolicyDefault, START_ON_HTTP, REGULAR_LINK, 618 RunReferrerTest(blink::WebReferrerPolicyDefault, START_ON_HTTP, REGULAR_LINK,
618 SERVER_REDIRECT_FROM_HTTP_TO_HTTPS, 619 SERVER_REDIRECT_FROM_HTTP_TO_HTTPS,
619 WindowOpenDisposition::CURRENT_TAB, 620 WindowOpenDisposition::CURRENT_TAB,
620 blink::WebMouseEvent::Button::Left, EXPECT_ORIGIN_AS_REFERRER, 621 blink::WebMouseEvent::Button::Left, EXPECT_ORIGIN_AS_REFERRER,
621 expected_referrer_policy); 622 expected_referrer_policy);
622 } 623 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698