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

Side by Side Diff: chrome/browser/android/offline_pages/prerender_adapter_unittest.cc

Issue 2098383002: Fix IsLowEndDevice check in PrerenderAdapter unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 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 #include "chrome/browser/android/offline_pages/prerender_adapter.h" 5 #include "chrome/browser/android/offline_pages/prerender_adapter.h"
6 6
7 #include "base/sys_info.h" 7 #include "base/sys_info.h"
8 #include "chrome/browser/prerender/prerender_manager_factory.h" 8 #include "chrome/browser/prerender/prerender_manager_factory.h"
9 #include "chrome/test/base/testing_profile.h" 9 #include "chrome/test/base/testing_profile.h"
10 #include "content/public/browser/browser_thread.h" 10 #include "content/public/browser/browser_thread.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 189 }
190 observer_start_called_ = false; 190 observer_start_called_ = false;
191 observer_stop_loading_called_ = false; 191 observer_stop_loading_called_ = false;
192 observer_dom_content_loaded_called_ = false; 192 observer_dom_content_loaded_called_ = false;
193 observer_stop_called_ = false; 193 observer_stop_called_ = false;
194 ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 194 ASSERT_TRUE(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
195 } 195 }
196 196
197 TEST_F(PrerenderAdapterTest, CanPrerender) { 197 TEST_F(PrerenderAdapterTest, CanPrerender) {
198 // Skip test on low end device until supported. 198 // Skip test on low end device until supported.
199 if (!base::SysInfo::IsLowEndDevice()) 199 if (base::SysInfo::IsLowEndDevice())
200 return; 200 return;
201 201
202 EXPECT_TRUE(adapter()->CanPrerender()); 202 EXPECT_TRUE(adapter()->CanPrerender());
203 203
204 prerender_manager()->SetMode(PrerenderManager::PRERENDER_MODE_DISABLED); 204 prerender_manager()->SetMode(PrerenderManager::PRERENDER_MODE_DISABLED);
205 EXPECT_FALSE(adapter()->CanPrerender()); 205 EXPECT_FALSE(adapter()->CanPrerender());
206 } 206 }
207 207
208 TEST_F(PrerenderAdapterTest, StartPrerenderFailsForUnsupportedScheme) { 208 TEST_F(PrerenderAdapterTest, StartPrerenderFailsForUnsupportedScheme) {
209 // Skip test on low end device until supported. 209 // Skip test on low end device until supported.
210 if (!base::SysInfo::IsLowEndDevice()) 210 if (base::SysInfo::IsLowEndDevice())
211 return; 211 return;
212 212
213 content::WebContents* session_contents = content::WebContents::Create( 213 content::WebContents* session_contents = content::WebContents::Create(
214 content::WebContents::CreateParams(profile())); 214 content::WebContents::CreateParams(profile()));
215 content::SessionStorageNamespace* sessionStorageNamespace = 215 content::SessionStorageNamespace* sessionStorageNamespace =
216 session_contents->GetController().GetDefaultSessionStorageNamespace(); 216 session_contents->GetController().GetDefaultSessionStorageNamespace();
217 gfx::Size renderWindowSize = session_contents->GetContainerBounds().size(); 217 gfx::Size renderWindowSize = session_contents->GetContainerBounds().size();
218 GURL url("file://file.test"); 218 GURL url("file://file.test");
219 EXPECT_FALSE(adapter()->StartPrerender( 219 EXPECT_FALSE(adapter()->StartPrerender(
220 profile(), url, sessionStorageNamespace, renderWindowSize)); 220 profile(), url, sessionStorageNamespace, renderWindowSize));
221 EXPECT_TRUE(prerender_contents_factory()->create_prerender_contents_called()); 221 EXPECT_TRUE(prerender_contents_factory()->create_prerender_contents_called());
222 EXPECT_FALSE(adapter()->IsActive()); 222 EXPECT_FALSE(adapter()->IsActive());
223 } 223 }
224 224
225 TEST_F(PrerenderAdapterTest, StartPrerenderSucceeds) { 225 TEST_F(PrerenderAdapterTest, StartPrerenderSucceeds) {
226 // Skip test on low end device until supported. 226 // Skip test on low end device until supported.
227 if (!base::SysInfo::IsLowEndDevice()) 227 if (base::SysInfo::IsLowEndDevice())
228 return; 228 return;
229 229
230 content::WebContents* session_contents = content::WebContents::Create( 230 content::WebContents* session_contents = content::WebContents::Create(
231 content::WebContents::CreateParams(profile())); 231 content::WebContents::CreateParams(profile()));
232 content::SessionStorageNamespace* sessionStorageNamespace = 232 content::SessionStorageNamespace* sessionStorageNamespace =
233 session_contents->GetController().GetDefaultSessionStorageNamespace(); 233 session_contents->GetController().GetDefaultSessionStorageNamespace();
234 gfx::Size renderWindowSize = session_contents->GetContainerBounds().size(); 234 gfx::Size renderWindowSize = session_contents->GetContainerBounds().size();
235 GURL url("https://url.test"); 235 GURL url("https://url.test");
236 EXPECT_TRUE(adapter()->StartPrerender(profile(), url, sessionStorageNamespace, 236 EXPECT_TRUE(adapter()->StartPrerender(profile(), url, sessionStorageNamespace,
237 renderWindowSize)); 237 renderWindowSize));
(...skipping 21 matching lines...) Expand all
259 EXPECT_EQ(FinalStatus::FINAL_STATUS_CANCELLED, adapter()->GetFinalStatus()); 259 EXPECT_EQ(FinalStatus::FINAL_STATUS_CANCELLED, adapter()->GetFinalStatus());
260 260
261 // Exercise access methods even though no interesting values set beneath. 261 // Exercise access methods even though no interesting values set beneath.
262 EXPECT_EQ(nullptr, adapter()->GetWebContents()); 262 EXPECT_EQ(nullptr, adapter()->GetWebContents());
263 263
264 adapter()->DestroyActive(); 264 adapter()->DestroyActive();
265 EXPECT_FALSE(adapter()->IsActive()); 265 EXPECT_FALSE(adapter()->IsActive());
266 } 266 }
267 267
268 } // namespace offline_pages 268 } // namespace offline_pages
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698