| OLD | NEW |
| 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 10506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10517 : url(url), priority(priority), seen(false) {} | 10517 : url(url), priority(priority), seen(false) {} |
| 10518 | 10518 |
| 10519 KURL url; | 10519 KURL url; |
| 10520 WebURLRequest::Priority priority; | 10520 WebURLRequest::Priority priority; |
| 10521 bool seen; | 10521 bool seen; |
| 10522 }; | 10522 }; |
| 10523 | 10523 |
| 10524 TestResourcePriorityWebFrameClient() {} | 10524 TestResourcePriorityWebFrameClient() {} |
| 10525 | 10525 |
| 10526 void willSendRequest(WebLocalFrame*, WebURLRequest& request) override { | 10526 void willSendRequest(WebLocalFrame*, WebURLRequest& request) override { |
| 10527 ExpectedRequest* expectedRequest = m_expectedRequests.get(request.url()); | 10527 ExpectedRequest* expectedRequest = m_expectedRequests.at(request.url()); |
| 10528 DCHECK(expectedRequest); | 10528 DCHECK(expectedRequest); |
| 10529 EXPECT_EQ(expectedRequest->priority, request.getPriority()); | 10529 EXPECT_EQ(expectedRequest->priority, request.getPriority()); |
| 10530 expectedRequest->seen = true; | 10530 expectedRequest->seen = true; |
| 10531 } | 10531 } |
| 10532 | 10532 |
| 10533 void addExpectedRequest(const KURL& url, WebURLRequest::Priority priority) { | 10533 void addExpectedRequest(const KURL& url, WebURLRequest::Priority priority) { |
| 10534 m_expectedRequests.insert(url, | 10534 m_expectedRequests.insert(url, |
| 10535 WTF::makeUnique<ExpectedRequest>(url, priority)); | 10535 WTF::makeUnique<ExpectedRequest>(url, priority)); |
| 10536 } | 10536 } |
| 10537 | 10537 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 10564 FrameTestHelpers::loadFrame( | 10564 FrameTestHelpers::loadFrame( |
| 10565 helper.webView()->mainFrame(), | 10565 helper.webView()->mainFrame(), |
| 10566 m_baseURL + "promote_img_in_viewport_priority.html"); | 10566 m_baseURL + "promote_img_in_viewport_priority.html"); |
| 10567 | 10567 |
| 10568 // Ensure the image in the viewport got promoted after the request was sent. | 10568 // Ensure the image in the viewport got promoted after the request was sent. |
| 10569 Resource* image = toWebLocalFrameImpl(helper.webView()->mainFrame()) | 10569 Resource* image = toWebLocalFrameImpl(helper.webView()->mainFrame()) |
| 10570 ->frame() | 10570 ->frame() |
| 10571 ->document() | 10571 ->document() |
| 10572 ->fetcher() | 10572 ->fetcher() |
| 10573 ->allResources() | 10573 ->allResources() |
| 10574 .get(toKURL("http://internal.test/image_slow.pl")); | 10574 .at(toKURL("http://internal.test/image_slow.pl")); |
| 10575 DCHECK(image); | 10575 DCHECK(image); |
| 10576 EXPECT_EQ(ResourceLoadPriorityHigh, image->resourceRequest().priority()); | 10576 EXPECT_EQ(ResourceLoadPriorityHigh, image->resourceRequest().priority()); |
| 10577 | 10577 |
| 10578 client.verifyAllRequests(); | 10578 client.verifyAllRequests(); |
| 10579 } | 10579 } |
| 10580 | 10580 |
| 10581 TEST_F(WebFrameTest, ScriptPriority) { | 10581 TEST_F(WebFrameTest, ScriptPriority) { |
| 10582 TestResourcePriorityWebFrameClient client; | 10582 TestResourcePriorityWebFrameClient client; |
| 10583 registerMockedHttpURLLoad("script_priority.html"); | 10583 registerMockedHttpURLLoad("script_priority.html"); |
| 10584 registerMockedHttpURLLoad("priorities/defer.js"); | 10584 registerMockedHttpURLLoad("priorities/defer.js"); |
| (...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11406 FrameTestHelpers::WebViewHelper openerHelper; | 11406 FrameTestHelpers::WebViewHelper openerHelper; |
| 11407 openerHelper.initialize(false, nullptr, &openerWebViewClient); | 11407 openerHelper.initialize(false, nullptr, &openerWebViewClient); |
| 11408 FrameTestHelpers::WebViewHelper helper; | 11408 FrameTestHelpers::WebViewHelper helper; |
| 11409 helper.initializeWithOpener(openerHelper.webView()->mainFrame()); | 11409 helper.initializeWithOpener(openerHelper.webView()->mainFrame()); |
| 11410 | 11410 |
| 11411 openerHelper.reset(); | 11411 openerHelper.reset(); |
| 11412 EXPECT_EQ(nullptr, helper.webView()->mainFrameImpl()->opener()); | 11412 EXPECT_EQ(nullptr, helper.webView()->mainFrameImpl()->opener()); |
| 11413 } | 11413 } |
| 11414 | 11414 |
| 11415 } // namespace blink | 11415 } // namespace blink |
| OLD | NEW |