| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_TEST_UTILS_H_ | 5 #ifndef CHROME_BROWSER_PRERENDER_PRERENDER_TEST_UTILS_H_ |
| 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_TEST_UTILS_H_ | 6 #define CHROME_BROWSER_PRERENDER_PRERENDER_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <functional> | 9 #include <functional> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 DISALLOW_COPY_AND_ASSIGN(PrerenderInProcessBrowserTest); | 368 DISALLOW_COPY_AND_ASSIGN(PrerenderInProcessBrowserTest); |
| 369 }; | 369 }; |
| 370 | 370 |
| 371 // Makes |url| respond to requests with the contents of |file|, counting the | 371 // Makes |url| respond to requests with the contents of |file|, counting the |
| 372 // number that start in |counter|. | 372 // number that start in |counter|. |
| 373 void CreateCountingInterceptorOnIO( | 373 void CreateCountingInterceptorOnIO( |
| 374 const GURL& url, | 374 const GURL& url, |
| 375 const base::FilePath& file, | 375 const base::FilePath& file, |
| 376 const base::WeakPtr<RequestCounter>& counter); | 376 const base::WeakPtr<RequestCounter>& counter); |
| 377 | 377 |
| 378 // Checks that |url| has been requested with net::LOAD_PREFETCH. Pings |counter| |
| 379 // after the flag is checked. |
| 380 void CreatePrefetchOnlyInterceptorOnIO( |
| 381 const GURL& url, |
| 382 const base::WeakPtr<RequestCounter>& counter); |
| 383 |
| 378 // Makes |url| respond to requests with the contents of |file|. | 384 // Makes |url| respond to requests with the contents of |file|. |
| 379 void CreateMockInterceptorOnIO(const GURL& url, const base::FilePath& file); | 385 void CreateMockInterceptorOnIO(const GURL& url, const base::FilePath& file); |
| 380 | 386 |
| 381 // Makes |url| never respond on the first load, and then with the contents of | 387 // Makes |url| never respond on the first load, and then with the contents of |
| 382 // |file| afterwards. When the first load has been scheduled, runs |callback| on | 388 // |file| afterwards. When the first load has been scheduled, runs |callback| on |
| 383 // the UI thread. | 389 // the UI thread. |
| 384 void CreateHangingFirstRequestInterceptorOnIO( | 390 void CreateHangingFirstRequestInterceptorOnIO( |
| 385 const GURL& url, const base::FilePath& file, base::Closure callback); | 391 const GURL& url, const base::FilePath& file, base::Closure callback); |
| 386 | 392 |
| 387 } // namespace test_utils | 393 } // namespace test_utils |
| 388 | 394 |
| 389 } // namespace prerender | 395 } // namespace prerender |
| 390 | 396 |
| 391 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_TEST_UTILS_H_ | 397 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_TEST_UTILS_H_ |
| OLD | NEW |