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

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

Issue 339593005: Set the target type when creating the request for main resource (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 6 years, 6 months 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 TEST_F(WebViewTest, FocusExistingFrameOnNavigate) 1385 TEST_F(WebViewTest, FocusExistingFrameOnNavigate)
1386 { 1386 {
1387 ViewCreatingWebViewClient client; 1387 ViewCreatingWebViewClient client;
1388 FrameTestHelpers::WebViewHelper m_webViewHelper; 1388 FrameTestHelpers::WebViewHelper m_webViewHelper;
1389 WebViewImpl* webViewImpl = m_webViewHelper.initialize(true, 0, &client); 1389 WebViewImpl* webViewImpl = m_webViewHelper.initialize(true, 0, &client);
1390 webViewImpl->page()->settings().setJavaScriptCanOpenWindowsAutomatically(tru e); 1390 webViewImpl->page()->settings().setJavaScriptCanOpenWindowsAutomatically(tru e);
1391 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewImpl->mainFrame()); 1391 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewImpl->mainFrame());
1392 frame->setName("_start"); 1392 frame->setName("_start");
1393 1393
1394 // Make a request that will open a new window 1394 // Make a request that will open a new window
1395 WebURLRequest webURLRequest; 1395 WebURLRequest webURLRequest(WebURL(), true, true);
1396 webURLRequest.initialize();
1397 WebCore::FrameLoadRequest request(0, webURLRequest.toResourceRequest(), "_bl ank"); 1396 WebCore::FrameLoadRequest request(0, webURLRequest.toResourceRequest(), "_bl ank");
1398 toLocalFrame(webViewImpl->page()->mainFrame())->loader().load(request); 1397 toLocalFrame(webViewImpl->page()->mainFrame())->loader().load(request);
1399 ASSERT_TRUE(client.createdWebView()); 1398 ASSERT_TRUE(client.createdWebView());
1400 EXPECT_FALSE(client.didFocusCalled()); 1399 EXPECT_FALSE(client.didFocusCalled());
1401 1400
1402 // Make a request from the new window that will navigate the original window . The original window should be focused. 1401 // Make a request from the new window that will navigate the original window . The original window should be focused.
1403 WebURLRequest webURLRequestWithTargetStart; 1402 WebURLRequest webURLRequestWithTargetStart(WebURL(), true, true);
1404 webURLRequestWithTargetStart.initialize();
1405 WebCore::FrameLoadRequest requestWithTargetStart(0, webURLRequestWithTargetS tart.toResourceRequest(), "_start"); 1403 WebCore::FrameLoadRequest requestWithTargetStart(0, webURLRequestWithTargetS tart.toResourceRequest(), "_start");
1406 toLocalFrame(toWebViewImpl(client.createdWebView())->page()->mainFrame())->l oader().load(requestWithTargetStart); 1404 toLocalFrame(toWebViewImpl(client.createdWebView())->page()->mainFrame())->l oader().load(requestWithTargetStart);
1407 EXPECT_TRUE(client.didFocusCalled()); 1405 EXPECT_TRUE(client.didFocusCalled());
1408 1406
1409 m_webViewHelper.reset(); // Remove dependency on locally scoped client. 1407 m_webViewHelper.reset(); // Remove dependency on locally scoped client.
1410 } 1408 }
1411 1409
1412 TEST_F(WebViewTest, DispatchesFocusOutFocusInOnViewToggleFocus) 1410 TEST_F(WebViewTest, DispatchesFocusOutFocusInOnViewToggleFocus)
1413 { 1411 {
1414 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), "focusout_focusin_events.html"); 1412 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c _str()), "focusout_focusin_events.html");
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 2028
2031 EXPECT_EQ(0, client.getUserGestureNotificationsCount()); 2029 EXPECT_EQ(0, client.getUserGestureNotificationsCount());
2032 2030
2033 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target"))); 2031 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target")));
2034 2032
2035 EXPECT_EQ(1, client.getUserGestureNotificationsCount()); 2033 EXPECT_EQ(1, client.getUserGestureNotificationsCount());
2036 webView->setAutofillClient(0); 2034 webView->setAutofillClient(0);
2037 } 2035 }
2038 2036
2039 } // namespace 2037 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698