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

Side by Side Diff: ui/app_list/pagination_model_unittest.cc

Issue 2211473003: Remove calls to deprecated MessageLoop methods on Windows and Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 3 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 | « ui/app_list/demo/app_list_demo_views.cc ('k') | ui/app_list/views/apps_grid_view_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/app_list/pagination_model.h" 5 #include "ui/app_list/pagination_model.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/run_loop.h"
12 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 #include "ui/app_list/pagination_model_observer.h" 15 #include "ui/app_list/pagination_model_observer.h"
15 16
16 namespace app_list { 17 namespace app_list {
17 namespace test { 18 namespace test {
18 19
19 class TestPaginationModelObserver : public PaginationModelObserver { 20 class TestPaginationModelObserver : public PaginationModelObserver {
20 public: 21 public:
21 TestPaginationModelObserver() 22 TestPaginationModelObserver()
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 EXPECT_EQ(4, observer_.selection_count()); 165 EXPECT_EQ(4, observer_.selection_count());
165 EXPECT_EQ(std::string("2 4 3 1"), observer_.selected_pages()); 166 EXPECT_EQ(std::string("2 4 3 1"), observer_.selected_pages());
166 } 167 }
167 168
168 TEST_F(PaginationModelTest, SelectPageAnimated) { 169 TEST_F(PaginationModelTest, SelectPageAnimated) {
169 const int kStartPage = 0; 170 const int kStartPage = 0;
170 171
171 // One transition. 172 // One transition.
172 SetStartPageAndExpects(kStartPage, 1, 0, 0); 173 SetStartPageAndExpects(kStartPage, 1, 0, 0);
173 pagination_.SelectPage(1, true /* animate */); 174 pagination_.SelectPage(1, true /* animate */);
174 base::MessageLoop::current()->Run(); 175 base::RunLoop().Run();
175 EXPECT_EQ(1, observer_.transition_start_count()); 176 EXPECT_EQ(1, observer_.transition_start_count());
176 EXPECT_EQ(1, observer_.transition_end_count()); 177 EXPECT_EQ(1, observer_.transition_end_count());
177 EXPECT_EQ(1, observer_.selection_count()); 178 EXPECT_EQ(1, observer_.selection_count());
178 EXPECT_EQ(std::string("1"), observer_.selected_pages()); 179 EXPECT_EQ(std::string("1"), observer_.selected_pages());
179 180
180 // Two transitions in a row. 181 // Two transitions in a row.
181 SetStartPageAndExpects(kStartPage, 2, 0, 0); 182 SetStartPageAndExpects(kStartPage, 2, 0, 0);
182 pagination_.SelectPage(1, true /* animate */); 183 pagination_.SelectPage(1, true /* animate */);
183 pagination_.SelectPage(3, true /* animate */); 184 pagination_.SelectPage(3, true /* animate */);
184 base::MessageLoop::current()->Run(); 185 base::RunLoop().Run();
185 EXPECT_EQ(2, observer_.transition_start_count()); 186 EXPECT_EQ(2, observer_.transition_start_count());
186 EXPECT_EQ(2, observer_.transition_end_count()); 187 EXPECT_EQ(2, observer_.transition_end_count());
187 EXPECT_EQ(2, observer_.selection_count()); 188 EXPECT_EQ(2, observer_.selection_count());
188 EXPECT_EQ(std::string("1 3"), observer_.selected_pages()); 189 EXPECT_EQ(std::string("1 3"), observer_.selected_pages());
189 190
190 // Transition to same page twice and only one should happen. 191 // Transition to same page twice and only one should happen.
191 SetStartPageAndExpects(kStartPage, 1, 0, 0); 192 SetStartPageAndExpects(kStartPage, 1, 0, 0);
192 pagination_.SelectPage(1, true /* animate */); 193 pagination_.SelectPage(1, true /* animate */);
193 pagination_.SelectPage(1, true /* animate */); // Ignored. 194 pagination_.SelectPage(1, true /* animate */); // Ignored.
194 base::MessageLoop::current()->Run(); 195 base::RunLoop().Run();
195 EXPECT_EQ(1, observer_.transition_start_count()); 196 EXPECT_EQ(1, observer_.transition_start_count());
196 EXPECT_EQ(1, observer_.transition_end_count()); 197 EXPECT_EQ(1, observer_.transition_end_count());
197 EXPECT_EQ(1, observer_.selection_count()); 198 EXPECT_EQ(1, observer_.selection_count());
198 EXPECT_EQ(std::string("1"), observer_.selected_pages()); 199 EXPECT_EQ(std::string("1"), observer_.selected_pages());
199 200
200 // More than two transitions and only the first and last would happen. 201 // More than two transitions and only the first and last would happen.
201 SetStartPageAndExpects(kStartPage, 2, 0, 0); 202 SetStartPageAndExpects(kStartPage, 2, 0, 0);
202 pagination_.SelectPage(1, true /* animate */); 203 pagination_.SelectPage(1, true /* animate */);
203 pagination_.SelectPage(3, true /* animate */); // Ignored 204 pagination_.SelectPage(3, true /* animate */); // Ignored
204 pagination_.SelectPage(4, true /* animate */); // Ignored 205 pagination_.SelectPage(4, true /* animate */); // Ignored
205 pagination_.SelectPage(2, true /* animate */); 206 pagination_.SelectPage(2, true /* animate */);
206 base::MessageLoop::current()->Run(); 207 base::RunLoop().Run();
207 EXPECT_EQ(2, observer_.transition_start_count()); 208 EXPECT_EQ(2, observer_.transition_start_count());
208 EXPECT_EQ(2, observer_.transition_end_count()); 209 EXPECT_EQ(2, observer_.transition_end_count());
209 EXPECT_EQ(2, observer_.selection_count()); 210 EXPECT_EQ(2, observer_.selection_count());
210 EXPECT_EQ(std::string("1 2"), observer_.selected_pages()); 211 EXPECT_EQ(std::string("1 2"), observer_.selected_pages());
211 212
212 // Multiple transitions with one transition that goes back to the original 213 // Multiple transitions with one transition that goes back to the original
213 // and followed by a new transition. Two transitions would happen. The first 214 // and followed by a new transition. Two transitions would happen. The first
214 // one will be reversed by the kStart transition and the second one will be 215 // one will be reversed by the kStart transition and the second one will be
215 // finished. 216 // finished.
216 SetStartPageAndExpects(kStartPage, 1, 0, 0); 217 SetStartPageAndExpects(kStartPage, 1, 0, 0);
217 pagination_.SelectPage(1, true /* animate */); 218 pagination_.SelectPage(1, true /* animate */);
218 pagination_.SelectPage(2, true /* animate */); // Ignored 219 pagination_.SelectPage(2, true /* animate */); // Ignored
219 pagination_.SelectPage(kStartPage, true /* animate */); 220 pagination_.SelectPage(kStartPage, true /* animate */);
220 pagination_.SelectPage(3, true /* animate */); 221 pagination_.SelectPage(3, true /* animate */);
221 base::MessageLoop::current()->Run(); 222 base::RunLoop().Run();
222 EXPECT_EQ(std::string("3"), observer_.selected_pages()); 223 EXPECT_EQ(std::string("3"), observer_.selected_pages());
223 } 224 }
224 225
225 TEST_F(PaginationModelTest, SimpleScroll) { 226 TEST_F(PaginationModelTest, SimpleScroll) {
226 const int kStartPage = 2; 227 const int kStartPage = 2;
227 228
228 // Scroll to the next page (negative delta) and finish it. 229 // Scroll to the next page (negative delta) and finish it.
229 SetStartPageAndExpects(kStartPage, 1, 0, 0); 230 SetStartPageAndExpects(kStartPage, 1, 0, 0);
230 pagination_.StartScroll(); 231 pagination_.StartScroll();
231 pagination_.UpdateScroll(-0.1); 232 pagination_.UpdateScroll(-0.1);
232 EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page); 233 EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page);
233 pagination_.EndScroll(false); // Finish transition 234 pagination_.EndScroll(false); // Finish transition
234 base::MessageLoop::current()->Run(); 235 base::RunLoop().Run();
235 EXPECT_EQ(1, observer_.selection_count()); 236 EXPECT_EQ(1, observer_.selection_count());
236 237
237 // Scroll to the previous page (positive delta) and finish it. 238 // Scroll to the previous page (positive delta) and finish it.
238 SetStartPageAndExpects(kStartPage, 1, 0, 0); 239 SetStartPageAndExpects(kStartPage, 1, 0, 0);
239 pagination_.StartScroll(); 240 pagination_.StartScroll();
240 pagination_.UpdateScroll(0.1); 241 pagination_.UpdateScroll(0.1);
241 EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page); 242 EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page);
242 pagination_.EndScroll(false); // Finish transition 243 pagination_.EndScroll(false); // Finish transition
243 base::MessageLoop::current()->Run(); 244 base::RunLoop().Run();
244 EXPECT_EQ(1, observer_.selection_count()); 245 EXPECT_EQ(1, observer_.selection_count());
245 246
246 // Scroll to the next page (negative delta) and cancel it. 247 // Scroll to the next page (negative delta) and cancel it.
247 SetStartPageAndExpects(kStartPage, 0, 1, 0); 248 SetStartPageAndExpects(kStartPage, 0, 1, 0);
248 pagination_.StartScroll(); 249 pagination_.StartScroll();
249 pagination_.UpdateScroll(-0.1); 250 pagination_.UpdateScroll(-0.1);
250 EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page); 251 EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page);
251 pagination_.EndScroll(true); // Cancel transition 252 pagination_.EndScroll(true); // Cancel transition
252 base::MessageLoop::current()->Run(); 253 base::RunLoop().Run();
253 EXPECT_EQ(0, observer_.selection_count()); 254 EXPECT_EQ(0, observer_.selection_count());
254 255
255 // Scroll to the previous page (position delta) and cancel it. 256 // Scroll to the previous page (position delta) and cancel it.
256 SetStartPageAndExpects(kStartPage, 0, 1, 0); 257 SetStartPageAndExpects(kStartPage, 0, 1, 0);
257 pagination_.StartScroll(); 258 pagination_.StartScroll();
258 pagination_.UpdateScroll(0.1); 259 pagination_.UpdateScroll(0.1);
259 EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page); 260 EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page);
260 pagination_.EndScroll(true); // Cancel transition 261 pagination_.EndScroll(true); // Cancel transition
261 base::MessageLoop::current()->Run(); 262 base::RunLoop().Run();
262 EXPECT_EQ(0, observer_.selection_count()); 263 EXPECT_EQ(0, observer_.selection_count());
263 } 264 }
264 265
265 TEST_F(PaginationModelTest, ScrollWithTransition) { 266 TEST_F(PaginationModelTest, ScrollWithTransition) {
266 const int kStartPage = 2; 267 const int kStartPage = 2;
267 268
268 // Scroll to the next page (negative delta) with a transition in the same 269 // Scroll to the next page (negative delta) with a transition in the same
269 // direction. 270 // direction.
270 SetStartPageAndExpects(kStartPage, 1, 0, 0); 271 SetStartPageAndExpects(kStartPage, 1, 0, 0);
271 pagination_.SetTransition(PaginationModel::Transition(kStartPage + 1, 0.5)); 272 pagination_.SetTransition(PaginationModel::Transition(kStartPage + 1, 0.5));
272 pagination_.StartScroll(); 273 pagination_.StartScroll();
273 pagination_.UpdateScroll(-0.1); 274 pagination_.UpdateScroll(-0.1);
274 EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page); 275 EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page);
275 EXPECT_EQ(0.6, pagination_.transition().progress); 276 EXPECT_EQ(0.6, pagination_.transition().progress);
276 pagination_.EndScroll(false); 277 pagination_.EndScroll(false);
277 base::MessageLoop::current()->Run(); 278 base::RunLoop().Run();
278 EXPECT_EQ(1, observer_.selection_count()); 279 EXPECT_EQ(1, observer_.selection_count());
279 280
280 // Scroll to the next page (negative delta) with a transition in a different 281 // Scroll to the next page (negative delta) with a transition in a different
281 // direction. 282 // direction.
282 SetStartPageAndExpects(kStartPage, 0, 1, 0); 283 SetStartPageAndExpects(kStartPage, 0, 1, 0);
283 pagination_.SetTransition(PaginationModel::Transition(kStartPage - 1, 0.5)); 284 pagination_.SetTransition(PaginationModel::Transition(kStartPage - 1, 0.5));
284 pagination_.StartScroll(); 285 pagination_.StartScroll();
285 pagination_.UpdateScroll(-0.1); 286 pagination_.UpdateScroll(-0.1);
286 EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page); 287 EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page);
287 EXPECT_EQ(0.4, pagination_.transition().progress); 288 EXPECT_EQ(0.4, pagination_.transition().progress);
288 pagination_.EndScroll(true); 289 pagination_.EndScroll(true);
289 290
290 // Scroll to the previous page (positive delta) with a transition in the same 291 // Scroll to the previous page (positive delta) with a transition in the same
291 // direction. 292 // direction.
292 SetStartPageAndExpects(kStartPage, 1, 0, 0); 293 SetStartPageAndExpects(kStartPage, 1, 0, 0);
293 pagination_.SetTransition(PaginationModel::Transition(kStartPage - 1, 0.5)); 294 pagination_.SetTransition(PaginationModel::Transition(kStartPage - 1, 0.5));
294 pagination_.StartScroll(); 295 pagination_.StartScroll();
295 pagination_.UpdateScroll(0.1); 296 pagination_.UpdateScroll(0.1);
296 EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page); 297 EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page);
297 EXPECT_EQ(0.6, pagination_.transition().progress); 298 EXPECT_EQ(0.6, pagination_.transition().progress);
298 pagination_.EndScroll(false); 299 pagination_.EndScroll(false);
299 base::MessageLoop::current()->Run(); 300 base::RunLoop().Run();
300 EXPECT_EQ(1, observer_.selection_count()); 301 EXPECT_EQ(1, observer_.selection_count());
301 302
302 // Scroll to the previous page (positive delta) with a transition in a 303 // Scroll to the previous page (positive delta) with a transition in a
303 // different direction. 304 // different direction.
304 SetStartPageAndExpects(kStartPage, 0, 1, 0); 305 SetStartPageAndExpects(kStartPage, 0, 1, 0);
305 pagination_.SetTransition(PaginationModel::Transition(kStartPage + 1, 0.5)); 306 pagination_.SetTransition(PaginationModel::Transition(kStartPage + 1, 0.5));
306 pagination_.StartScroll(); 307 pagination_.StartScroll();
307 pagination_.UpdateScroll(0.1); 308 pagination_.UpdateScroll(0.1);
308 EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page); 309 EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page);
309 EXPECT_EQ(0.4, pagination_.transition().progress); 310 EXPECT_EQ(0.4, pagination_.transition().progress);
310 pagination_.EndScroll(true); 311 pagination_.EndScroll(true);
311 } 312 }
312 313
313 TEST_F(PaginationModelTest, LongScroll) { 314 TEST_F(PaginationModelTest, LongScroll) {
314 const int kStartPage = 2; 315 const int kStartPage = 2;
315 316
316 // Scroll to the next page (negative delta) with a transition in the same 317 // Scroll to the next page (negative delta) with a transition in the same
317 // direction. And scroll enough to change page twice. 318 // direction. And scroll enough to change page twice.
318 SetStartPageAndExpects(kStartPage, 2, 0, 0); 319 SetStartPageAndExpects(kStartPage, 2, 0, 0);
319 pagination_.SetTransition(PaginationModel::Transition(kStartPage + 1, 0.5)); 320 pagination_.SetTransition(PaginationModel::Transition(kStartPage + 1, 0.5));
320 pagination_.StartScroll(); 321 pagination_.StartScroll();
321 pagination_.UpdateScroll(-0.1); 322 pagination_.UpdateScroll(-0.1);
322 EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page); 323 EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page);
323 EXPECT_EQ(0.6, pagination_.transition().progress); 324 EXPECT_EQ(0.6, pagination_.transition().progress);
324 pagination_.UpdateScroll(-0.5); 325 pagination_.UpdateScroll(-0.5);
325 EXPECT_EQ(1, observer_.selection_count()); 326 EXPECT_EQ(1, observer_.selection_count());
326 pagination_.UpdateScroll(-0.5); 327 pagination_.UpdateScroll(-0.5);
327 EXPECT_EQ(kStartPage + 2, pagination_.transition().target_page); 328 EXPECT_EQ(kStartPage + 2, pagination_.transition().target_page);
328 pagination_.EndScroll(false); 329 pagination_.EndScroll(false);
329 base::MessageLoop::current()->Run(); 330 base::RunLoop().Run();
330 EXPECT_EQ(2, observer_.selection_count()); 331 EXPECT_EQ(2, observer_.selection_count());
331 332
332 // Scroll to the next page (negative delta) with a transition in a different 333 // Scroll to the next page (negative delta) with a transition in a different
333 // direction. And scroll enough to revert it and switch page once. 334 // direction. And scroll enough to revert it and switch page once.
334 SetStartPageAndExpects(kStartPage, 1, 0, 0); 335 SetStartPageAndExpects(kStartPage, 1, 0, 0);
335 pagination_.SetTransition(PaginationModel::Transition(kStartPage - 1, 0.5)); 336 pagination_.SetTransition(PaginationModel::Transition(kStartPage - 1, 0.5));
336 pagination_.StartScroll(); 337 pagination_.StartScroll();
337 pagination_.UpdateScroll(-0.1); 338 pagination_.UpdateScroll(-0.1);
338 EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page); 339 EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page);
339 EXPECT_EQ(0.4, pagination_.transition().progress); 340 EXPECT_EQ(0.4, pagination_.transition().progress);
340 pagination_.UpdateScroll(-0.5); // This clears the transition. 341 pagination_.UpdateScroll(-0.5); // This clears the transition.
341 pagination_.UpdateScroll(-0.5); // This starts a new transition. 342 pagination_.UpdateScroll(-0.5); // This starts a new transition.
342 EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page); 343 EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page);
343 pagination_.EndScroll(false); 344 pagination_.EndScroll(false);
344 base::MessageLoop::current()->Run(); 345 base::RunLoop().Run();
345 EXPECT_EQ(1, observer_.selection_count()); 346 EXPECT_EQ(1, observer_.selection_count());
346 347
347 // Similar cases as above but in the opposite direction. 348 // Similar cases as above but in the opposite direction.
348 // Scroll to the previous page (positive delta) with a transition in the same 349 // Scroll to the previous page (positive delta) with a transition in the same
349 // direction. And scroll enough to change page twice. 350 // direction. And scroll enough to change page twice.
350 SetStartPageAndExpects(kStartPage, 2, 0, 0); 351 SetStartPageAndExpects(kStartPage, 2, 0, 0);
351 pagination_.SetTransition(PaginationModel::Transition(kStartPage - 1, 0.5)); 352 pagination_.SetTransition(PaginationModel::Transition(kStartPage - 1, 0.5));
352 pagination_.StartScroll(); 353 pagination_.StartScroll();
353 pagination_.UpdateScroll(0.1); 354 pagination_.UpdateScroll(0.1);
354 EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page); 355 EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page);
355 EXPECT_EQ(0.6, pagination_.transition().progress); 356 EXPECT_EQ(0.6, pagination_.transition().progress);
356 pagination_.UpdateScroll(0.5); 357 pagination_.UpdateScroll(0.5);
357 EXPECT_EQ(1, observer_.selection_count()); 358 EXPECT_EQ(1, observer_.selection_count());
358 pagination_.UpdateScroll(0.5); 359 pagination_.UpdateScroll(0.5);
359 EXPECT_EQ(kStartPage - 2, pagination_.transition().target_page); 360 EXPECT_EQ(kStartPage - 2, pagination_.transition().target_page);
360 pagination_.EndScroll(false); 361 pagination_.EndScroll(false);
361 base::MessageLoop::current()->Run(); 362 base::RunLoop().Run();
362 EXPECT_EQ(2, observer_.selection_count()); 363 EXPECT_EQ(2, observer_.selection_count());
363 364
364 // Scroll to the previous page (positive delta) with a transition in a 365 // Scroll to the previous page (positive delta) with a transition in a
365 // different direction. And scroll enough to revert it and switch page once. 366 // different direction. And scroll enough to revert it and switch page once.
366 SetStartPageAndExpects(kStartPage, 1, 0, 0); 367 SetStartPageAndExpects(kStartPage, 1, 0, 0);
367 pagination_.SetTransition(PaginationModel::Transition(kStartPage + 1, 0.5)); 368 pagination_.SetTransition(PaginationModel::Transition(kStartPage + 1, 0.5));
368 pagination_.StartScroll(); 369 pagination_.StartScroll();
369 pagination_.UpdateScroll(0.1); 370 pagination_.UpdateScroll(0.1);
370 EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page); 371 EXPECT_EQ(kStartPage + 1, pagination_.transition().target_page);
371 EXPECT_EQ(0.4, pagination_.transition().progress); 372 EXPECT_EQ(0.4, pagination_.transition().progress);
372 pagination_.UpdateScroll(0.5); // This clears the transition. 373 pagination_.UpdateScroll(0.5); // This clears the transition.
373 pagination_.UpdateScroll(0.5); // This starts a new transition. 374 pagination_.UpdateScroll(0.5); // This starts a new transition.
374 EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page); 375 EXPECT_EQ(kStartPage - 1, pagination_.transition().target_page);
375 pagination_.EndScroll(false); 376 pagination_.EndScroll(false);
376 base::MessageLoop::current()->Run(); 377 base::RunLoop().Run();
377 EXPECT_EQ(1, observer_.selection_count()); 378 EXPECT_EQ(1, observer_.selection_count());
378 } 379 }
379 380
380 TEST_F(PaginationModelTest, FireTransitionZero) { 381 TEST_F(PaginationModelTest, FireTransitionZero) {
381 const int kStartPage = 2; 382 const int kStartPage = 2;
382 383
383 // Scroll to next page then revert the scroll and make sure transition 384 // Scroll to next page then revert the scroll and make sure transition
384 // progress 0 is fired when previous scroll is cleared. 385 // progress 0 is fired when previous scroll is cleared.
385 SetStartPageAndExpects(kStartPage, 0, 0, 0); 386 SetStartPageAndExpects(kStartPage, 0, 0, 0);
386 pagination_.StartScroll(); 387 pagination_.StartScroll();
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 EXPECT_EQ(1, pagination_.selected_page()); 424 EXPECT_EQ(1, pagination_.selected_page());
424 425
425 // But if the currently selected_page exceeds the total number of pages, 426 // But if the currently selected_page exceeds the total number of pages,
426 // it automatically switches to the last page. 427 // it automatically switches to the last page.
427 pagination_.SetTotalPages(1); 428 pagination_.SetTotalPages(1);
428 EXPECT_EQ(0, pagination_.selected_page()); 429 EXPECT_EQ(0, pagination_.selected_page());
429 } 430 }
430 431
431 } // namespace test 432 } // namespace test
432 } // namespace app_list 433 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/demo/app_list_demo_views.cc ('k') | ui/app_list/views/apps_grid_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698