| OLD | NEW |
| 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 "components/reading_list/ios/reading_list_store.h" | 5 #include "components/reading_list/ios/reading_list_store.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 entryA.set_title("Foo Bar"); | 324 entryA.set_title("Foo Bar"); |
| 325 entryB.set_title("Foo Bar"); | 325 entryB.set_title("Foo Bar"); |
| 326 entryA.set_status(sync_pb::ReadingListSpecifics::UNREAD); | 326 entryA.set_status(sync_pb::ReadingListSpecifics::UNREAD); |
| 327 entryB.set_status(sync_pb::ReadingListSpecifics::UNREAD); | 327 entryB.set_status(sync_pb::ReadingListSpecifics::UNREAD); |
| 328 entryA.set_creation_time_us(10); | 328 entryA.set_creation_time_us(10); |
| 329 entryB.set_creation_time_us(10); | 329 entryB.set_creation_time_us(10); |
| 330 entryA.set_first_read_time_us(50); | 330 entryA.set_first_read_time_us(50); |
| 331 entryB.set_first_read_time_us(50); | 331 entryB.set_first_read_time_us(50); |
| 332 entryA.set_update_time_us(100); | 332 entryA.set_update_time_us(100); |
| 333 entryB.set_update_time_us(100); | 333 entryB.set_update_time_us(100); |
| 334 entryA.set_update_title_time_us(110); |
| 335 entryB.set_update_title_time_us(110); |
| 334 // Equal entries can be submitted. | 336 // Equal entries can be submitted. |
| 335 ExpectAB(entryA, entryB, true); | 337 ExpectAB(entryA, entryB, true); |
| 336 ExpectAB(entryB, entryA, true); | 338 ExpectAB(entryB, entryA, true); |
| 337 | 339 |
| 338 // Try to update each field. | 340 // Try to update each field. |
| 339 | 341 |
| 340 // You cannot change the URL of an entry. | 342 // You cannot change the URL of an entry. |
| 341 entryA.set_url("http://foo.foo/"); | 343 entryA.set_url("http://foo.foo/"); |
| 342 EXPECT_FALSE(ReadingListStore::CompareEntriesForSync(entryA, entryB)); | 344 EXPECT_FALSE(ReadingListStore::CompareEntriesForSync(entryA, entryB)); |
| 343 EXPECT_FALSE(ReadingListStore::CompareEntriesForSync(entryB, entryA)); | 345 EXPECT_FALSE(ReadingListStore::CompareEntriesForSync(entryB, entryA)); |
| 344 entryA.set_url("http://foo.bar/"); | 346 entryA.set_url("http://foo.bar/"); |
| 345 | 347 |
| 346 // You can set a title to a title later in alphabetical order. | 348 // You can set a title to a title later in alphabetical order if the |
| 349 // update_title_time is the same. If a title has been more recently updated, |
| 350 // the only possible transition is to this one. |
| 347 entryA.set_title(""); | 351 entryA.set_title(""); |
| 348 ExpectAB(entryA, entryB, true); | 352 ExpectAB(entryA, entryB, true); |
| 349 ExpectAB(entryB, entryA, false); | 353 ExpectAB(entryB, entryA, false); |
| 354 entryA.set_update_title_time_us(109); |
| 355 ExpectAB(entryA, entryB, true); |
| 356 ExpectAB(entryB, entryA, false); |
| 357 entryA.set_update_title_time_us(110); |
| 358 |
| 350 entryA.set_title("Foo Aar"); | 359 entryA.set_title("Foo Aar"); |
| 351 ExpectAB(entryA, entryB, true); | 360 ExpectAB(entryA, entryB, true); |
| 352 ExpectAB(entryB, entryA, false); | 361 ExpectAB(entryB, entryA, false); |
| 362 entryA.set_update_title_time_us(109); |
| 363 ExpectAB(entryA, entryB, true); |
| 364 ExpectAB(entryB, entryA, false); |
| 365 entryA.set_update_title_time_us(110); |
| 366 |
| 353 entryA.set_title("Foo Ba"); | 367 entryA.set_title("Foo Ba"); |
| 354 ExpectAB(entryA, entryB, true); | 368 ExpectAB(entryA, entryB, true); |
| 355 ExpectAB(entryB, entryA, false); | 369 ExpectAB(entryB, entryA, false); |
| 370 entryA.set_update_title_time_us(109); |
| 371 ExpectAB(entryA, entryB, true); |
| 372 ExpectAB(entryB, entryA, false); |
| 373 entryA.set_update_title_time_us(110); |
| 374 |
| 375 entryA.set_title("Foo Bas"); |
| 376 ExpectAB(entryA, entryB, false); |
| 377 ExpectAB(entryB, entryA, true); |
| 378 entryA.set_update_title_time_us(109); |
| 379 ExpectAB(entryA, entryB, true); |
| 380 ExpectAB(entryB, entryA, false); |
| 381 entryA.set_update_title_time_us(110); |
| 356 entryA.set_title("Foo Bar"); | 382 entryA.set_title("Foo Bar"); |
| 357 | 383 |
| 384 // Update times. |
| 358 entryA.set_creation_time_us(9); | 385 entryA.set_creation_time_us(9); |
| 359 ExpectAB(entryA, entryB, true); | 386 ExpectAB(entryA, entryB, true); |
| 360 ExpectAB(entryB, entryA, false); | 387 ExpectAB(entryB, entryA, false); |
| 361 entryA.set_first_read_time_us(51); | 388 entryA.set_first_read_time_us(51); |
| 362 ExpectAB(entryA, entryB, true); | 389 ExpectAB(entryA, entryB, true); |
| 363 ExpectAB(entryB, entryA, false); | 390 ExpectAB(entryB, entryA, false); |
| 364 entryA.set_first_read_time_us(49); | 391 entryA.set_first_read_time_us(49); |
| 365 ExpectAB(entryA, entryB, true); | 392 ExpectAB(entryA, entryB, true); |
| 366 ExpectAB(entryB, entryA, false); | 393 ExpectAB(entryB, entryA, false); |
| 367 entryA.set_first_read_time_us(0); | 394 entryA.set_first_read_time_us(0); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 entryB.set_status(status_oder[index_a]); | 429 entryB.set_status(status_oder[index_a]); |
| 403 ExpectAB(entryA, entryB, true); | 430 ExpectAB(entryA, entryB, true); |
| 404 ExpectAB(entryB, entryA, true); | 431 ExpectAB(entryB, entryA, true); |
| 405 for (int index_b = index_a + 1; index_b < 3; index_b++) { | 432 for (int index_b = index_a + 1; index_b < 3; index_b++) { |
| 406 entryB.set_status(status_oder[index_b]); | 433 entryB.set_status(status_oder[index_b]); |
| 407 ExpectAB(entryA, entryB, true); | 434 ExpectAB(entryA, entryB, true); |
| 408 ExpectAB(entryB, entryA, false); | 435 ExpectAB(entryB, entryA, false); |
| 409 } | 436 } |
| 410 } | 437 } |
| 411 } | 438 } |
| OLD | NEW |