OLD | NEW |
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 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 ViewCreatingWebViewClient client; | 1251 ViewCreatingWebViewClient client; |
1252 FrameTestHelpers::WebViewHelper m_webViewHelper; | 1252 FrameTestHelpers::WebViewHelper m_webViewHelper; |
1253 WebViewImpl* webViewImpl = m_webViewHelper.initialize(true, 0, &client); | 1253 WebViewImpl* webViewImpl = m_webViewHelper.initialize(true, 0, &client); |
1254 webViewImpl->page()->settings().setJavaScriptCanOpenWindowsAutomatically(tru
e); | 1254 webViewImpl->page()->settings().setJavaScriptCanOpenWindowsAutomatically(tru
e); |
1255 WebFrameImpl* frame = toWebFrameImpl(webViewImpl->mainFrame()); | 1255 WebFrameImpl* frame = toWebFrameImpl(webViewImpl->mainFrame()); |
1256 frame->setName("_start"); | 1256 frame->setName("_start"); |
1257 | 1257 |
1258 // Make a request that will open a new window | 1258 // Make a request that will open a new window |
1259 WebURLRequest webURLRequest; | 1259 WebURLRequest webURLRequest; |
1260 webURLRequest.initialize(); | 1260 webURLRequest.initialize(); |
1261 WebCore::FrameLoadRequest request(0, webURLRequest.toResourceRequest(), WTF:
:String("_blank")); | 1261 WebCore::FrameLoadRequest request(0, webURLRequest.toResourceRequest(), "_bl
ank"); |
1262 webViewImpl->page()->mainFrame()->loader().load(request); | 1262 webViewImpl->page()->mainFrame()->loader().load(request); |
1263 ASSERT_TRUE(client.createdWebView()); | 1263 ASSERT_TRUE(client.createdWebView()); |
1264 EXPECT_FALSE(client.didFocusCalled()); | 1264 EXPECT_FALSE(client.didFocusCalled()); |
1265 | 1265 |
1266 // Make a request from the new window that will navigate the original window
. The original window should be focused. | 1266 // Make a request from the new window that will navigate the original window
. The original window should be focused. |
1267 WebURLRequest webURLRequestWithTargetStart; | 1267 WebURLRequest webURLRequestWithTargetStart; |
1268 webURLRequestWithTargetStart.initialize(); | 1268 webURLRequestWithTargetStart.initialize(); |
1269 WebCore::FrameLoadRequest requestWithTargetStart(0, webURLRequestWithTargetS
tart.toResourceRequest(), WTF::String("_start")); | 1269 WebCore::FrameLoadRequest requestWithTargetStart(0, webURLRequestWithTargetS
tart.toResourceRequest(), "_start"); |
1270 toWebViewImpl(client.createdWebView())->page()->mainFrame()->loader().load(r
equestWithTargetStart); | 1270 toWebViewImpl(client.createdWebView())->page()->mainFrame()->loader().load(r
equestWithTargetStart); |
1271 EXPECT_TRUE(client.didFocusCalled()); | 1271 EXPECT_TRUE(client.didFocusCalled()); |
1272 | 1272 |
1273 m_webViewHelper.reset(); // Remove dependency on locally scoped client. | 1273 m_webViewHelper.reset(); // Remove dependency on locally scoped client. |
1274 } | 1274 } |
1275 | 1275 |
1276 TEST_F(WebViewTest, DispatchesFocusOutFocusInOnViewToggleFocus) | 1276 TEST_F(WebViewTest, DispatchesFocusOutFocusInOnViewToggleFocus) |
1277 { | 1277 { |
1278 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), "focusout_focusin_events.html"); | 1278 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c
_str()), "focusout_focusin_events.html"); |
1279 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "focusout_f
ocusin_events.html", true, 0); | 1279 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "focusout_f
ocusin_events.html", true, 0); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1403 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); | 1403 WebView* webView = m_webViewHelper.initializeAndLoad(m_baseURL + "smartclip.
html"); |
1404 webView->resize(WebSize(500, 500)); | 1404 webView->resize(WebSize(500, 500)); |
1405 webView->layout(); | 1405 webView->layout(); |
1406 WebRect cropRect(300, 125, 100, 50); | 1406 WebRect cropRect(300, 125, 100, 50); |
1407 | 1407 |
1408 // FIXME: We should test the structure of the data we get back. | 1408 // FIXME: We should test the structure of the data we get back. |
1409 EXPECT_FALSE(webView->getSmartClipData(cropRect).isEmpty()); | 1409 EXPECT_FALSE(webView->getSmartClipData(cropRect).isEmpty()); |
1410 } | 1410 } |
1411 | 1411 |
1412 } | 1412 } |
OLD | NEW |