| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 void prefetchFinished() override {} | 152 void prefetchFinished() override {} |
| 153 | 153 |
| 154 Vector<WebPrerender> m_addedPrerenders; | 154 Vector<WebPrerender> m_addedPrerenders; |
| 155 Vector<WebPrerender> m_canceledPrerenders; | 155 Vector<WebPrerender> m_canceledPrerenders; |
| 156 Vector<WebPrerender> m_abandonedPrerenders; | 156 Vector<WebPrerender> m_abandonedPrerenders; |
| 157 }; | 157 }; |
| 158 | 158 |
| 159 class PrerenderingTest : public ::testing::Test { | 159 class PrerenderingTest : public ::testing::Test { |
| 160 public: | 160 public: |
| 161 ~PrerenderingTest() override { | 161 ~PrerenderingTest() override { |
| 162 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); | 162 Platform::current() |
| 163 WebCache::clear(); | 163 ->getURLLoaderMockFactory() |
| 164 ->unregisterAllURLsAndClearMemoryCache(); |
| 164 } | 165 } |
| 165 | 166 |
| 166 void initialize(const char* baseURL, const char* fileName) { | 167 void initialize(const char* baseURL, const char* fileName) { |
| 167 URLTestHelpers::registerMockedURLLoadFromBase( | 168 URLTestHelpers::registerMockedURLLoadFromBase( |
| 168 WebString::fromUTF8(baseURL), blink::testing::webTestDataPath(), | 169 WebString::fromUTF8(baseURL), blink::testing::webTestDataPath(), |
| 169 WebString::fromUTF8(fileName)); | 170 WebString::fromUTF8(fileName)); |
| 170 const bool RunJavascript = true; | 171 const bool RunJavascript = true; |
| 171 m_webViewHelper.initialize(RunJavascript); | 172 m_webViewHelper.initialize(RunJavascript); |
| 172 m_webViewHelper.webView()->setPrerendererClient(&m_prerendererClient); | 173 m_webViewHelper.webView()->setPrerendererClient(&m_prerendererClient); |
| 173 | 174 |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 | 468 |
| 468 WebPrerender relNextAndPrerender = prerendererClient()->releaseWebPrerender(); | 469 WebPrerender relNextAndPrerender = prerendererClient()->releaseWebPrerender(); |
| 469 EXPECT_EQ(toWebURL("http://rel-next-and-prerender.com/"), | 470 EXPECT_EQ(toWebURL("http://rel-next-and-prerender.com/"), |
| 470 relNextAndPrerender.url()); | 471 relNextAndPrerender.url()); |
| 471 EXPECT_EQ( | 472 EXPECT_EQ( |
| 472 static_cast<unsigned>(PrerenderRelTypeNext | PrerenderRelTypePrerender), | 473 static_cast<unsigned>(PrerenderRelTypeNext | PrerenderRelTypePrerender), |
| 473 relNextAndPrerender.relTypes()); | 474 relNextAndPrerender.relTypes()); |
| 474 } | 475 } |
| 475 | 476 |
| 476 } // namespace blink | 477 } // namespace blink |
| OLD | NEW |