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

Side by Side Diff: chrome/android/javatests/src/org/chromium/chrome/browser/prerender/ExternalPrerenderRequestTest.java

Issue 1767243002: Update prerender policy for custom tabs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated comments Created 4 years, 9 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 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 package org.chromium.chrome.browser.prerender; 5 package org.chromium.chrome.browser.prerender;
6 6
7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E ND_DEVICE; 7 import static org.chromium.base.test.util.Restriction.RESTRICTION_TYPE_NON_LOW_E ND_DEVICE;
8 8
9 import android.os.Environment; 9 import android.os.Environment;
10 import android.test.UiThreadTest; 10 import android.test.UiThreadTest;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 73
74 @MediumTest 74 @MediumTest
75 @UiThreadTest 75 @UiThreadTest
76 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) 76 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
77 @Feature({"Prerender"}) 77 @Feature({"Prerender"})
78 /** 78 /**
79 * Test adding a prerender and canceling that to add a new one. 79 * Test adding a prerender and canceling that to add a new one.
80 */ 80 */
81 public void testAddPrerenderAndCancel() throws InterruptedException { 81 public void testAddPrerenderAndCancel() throws InterruptedException {
82 WebContents webContents = mHandler.addPrerender(mProfile, mGoogleUrl, "" , 0, 0); 82 WebContents webContents = mHandler.addPrerender(mProfile, mGoogleUrl, "" , 0, 0, false);
83 assertTrue(ExternalPrerenderHandler.hasPrerenderedUrl( 83 assertTrue(ExternalPrerenderHandler.hasPrerenderedUrl(
84 mProfile, mGoogleUrl, webContents)); 84 mProfile, mGoogleUrl, webContents));
85 85
86 mHandler.cancelCurrentPrerender(); 86 mHandler.cancelCurrentPrerender();
87 assertFalse(ExternalPrerenderHandler.hasPrerenderedUrl( 87 assertFalse(ExternalPrerenderHandler.hasPrerenderedUrl(
88 mProfile, mGoogleUrl, webContents)); 88 mProfile, mGoogleUrl, webContents));
89 webContents.destroy(); 89 webContents.destroy();
90 Thread.sleep(PRERENDER_DELAY_MS); 90 Thread.sleep(PRERENDER_DELAY_MS);
91 webContents = mHandler.addPrerender(mProfile, mYoutubeUrl, "", 0, 0); 91 webContents = mHandler.addPrerender(mProfile, mYoutubeUrl, "", 0, 0, fal se);
92 assertTrue(ExternalPrerenderHandler.hasPrerenderedUrl( 92 assertTrue(ExternalPrerenderHandler.hasPrerenderedUrl(
93 mProfile, mYoutubeUrl, webContents)); 93 mProfile, mYoutubeUrl, webContents));
94 } 94 }
95 95
96 @SmallTest 96 @SmallTest
97 @UiThreadTest 97 @UiThreadTest
98 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) 98 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
99 @Feature({"Prerender"}) 99 @Feature({"Prerender"})
100 /** 100 /**
101 * Test calling cancel without any added prerenders. 101 * Test calling cancel without any added prerenders.
102 */ 102 */
103 public void testCancelPrerender() { 103 public void testCancelPrerender() {
104 mHandler.cancelCurrentPrerender(); 104 mHandler.cancelCurrentPrerender();
105 WebContents webContents = mHandler.addPrerender(mProfile, mGoogleUrl, "" , 0, 0); 105 WebContents webContents = mHandler.addPrerender(mProfile, mGoogleUrl, "" , 0, 0, false);
106 assertTrue(ExternalPrerenderHandler.hasPrerenderedUrl( 106 assertTrue(ExternalPrerenderHandler.hasPrerenderedUrl(
107 mProfile, mGoogleUrl, webContents)); 107 mProfile, mGoogleUrl, webContents));
108 } 108 }
109 109
110 @MediumTest 110 @MediumTest
111 @UiThreadTest 111 @UiThreadTest
112 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE) 112 @Restriction(RESTRICTION_TYPE_NON_LOW_END_DEVICE)
113 @Feature({"Prerender"}) 113 @Feature({"Prerender"})
114 /** 114 /**
115 * Test adding two prerenders without canceling the first one. 115 * Test adding two prerenders without canceling the first one.
116 */ 116 */
117 public void testAddingPrerendersInaRow() throws InterruptedException { 117 public void testAddingPrerendersInaRow() throws InterruptedException {
118 WebContents webContents = mHandler.addPrerender(mProfile, mGoogleUrl, "" , 0, 0); 118 WebContents webContents = mHandler.addPrerender(mProfile, mGoogleUrl, "" , 0, 0, false);
119 assertTrue(ExternalPrerenderHandler.hasPrerenderedUrl( 119 assertTrue(ExternalPrerenderHandler.hasPrerenderedUrl(
120 mProfile, mGoogleUrl, webContents)); 120 mProfile, mGoogleUrl, webContents));
121 Thread.sleep(PRERENDER_DELAY_MS); 121 Thread.sleep(PRERENDER_DELAY_MS);
122 WebContents newWebContents = mHandler.addPrerender(mProfile, mYoutubeUrl , "", 0, 0); 122 WebContents newWebContents = mHandler.addPrerender(mProfile, mYoutubeUrl , "", 0, 0, false);
123 assertTrue(ExternalPrerenderHandler.hasPrerenderedUrl( 123 assertTrue(ExternalPrerenderHandler.hasPrerenderedUrl(
124 mProfile, mYoutubeUrl, newWebContents)); 124 mProfile, mYoutubeUrl, newWebContents));
125 } 125 }
126 } 126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698