browser_suggestedIndex_5_search_10_url.js (25038B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 // This test checks row visibility during view updates when rows with suggested 6 // indexes are added and removed. Each task performs two searches: Search 1 7 // returns 5 results with search suggestions, and search 2 returns 10 results 8 // with URL results. 9 10 "use strict"; 11 12 // Search 1: 13 // 5 results, no suggestedIndex 14 // Search 2: 15 // 10 results including suggestedIndex = 1 16 // Expected visible rows during update: 17 // 5 original rows with no changes 18 add_suggestedIndex_task({ 19 search1: { 20 otherCount: 4, 21 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 22 viewCount: 5, 23 }, 24 search2: { 25 otherCount: 10, 26 otherType: UrlbarUtils.RESULT_TYPE.URL, 27 suggestedIndex: 1, 28 viewCount: 10, 29 }, 30 duringUpdate: [ 31 { count: 1 }, 32 { count: 4, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 33 { 34 count: 1, 35 type: UrlbarUtils.RESULT_TYPE.URL, 36 suggestedIndex: 1, 37 hidden: true, 38 }, 39 { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 40 ], 41 }); 42 43 // Search 1: 44 // 5 results, no suggestedIndex 45 // Search 2: 46 // 10 results including suggestedIndex = 2 47 // Expected visible rows during update: 48 // 5 search-1 rows + 1 search-2 row (the one before the suggestedIndex row) 49 add_suggestedIndex_task({ 50 search1: { 51 otherCount: 4, 52 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 53 viewCount: 5, 54 }, 55 search2: { 56 otherCount: 10, 57 otherType: UrlbarUtils.RESULT_TYPE.URL, 58 suggestedIndex: 2, 59 viewCount: 10, 60 }, 61 duringUpdate: [ 62 { count: 1 }, 63 { count: 4, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 64 { count: 1, type: UrlbarUtils.RESULT_TYPE.URL }, 65 { 66 count: 1, 67 type: UrlbarUtils.RESULT_TYPE.URL, 68 suggestedIndex: 2, 69 hidden: true, 70 }, 71 { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 72 ], 73 }); 74 75 // Search 1: 76 // 5 results, no suggestedIndex 77 // Search 2: 78 // 10 results including suggestedIndex = 4 79 // Expected visible rows during update: 80 // 5 search-1 rows + 3 search-2 rows (the ones before the suggestedIndex row) 81 add_suggestedIndex_task({ 82 search1: { 83 otherCount: 4, 84 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 85 viewCount: 5, 86 }, 87 search2: { 88 otherCount: 10, 89 otherType: UrlbarUtils.RESULT_TYPE.URL, 90 suggestedIndex: 4, 91 viewCount: 10, 92 }, 93 duringUpdate: [ 94 { count: 1 }, 95 { count: 4, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 96 { count: 3, type: UrlbarUtils.RESULT_TYPE.URL }, 97 { 98 count: 1, 99 type: UrlbarUtils.RESULT_TYPE.URL, 100 suggestedIndex: 4, 101 hidden: true, 102 }, 103 { count: 5, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 104 ], 105 }); 106 107 // Search 1: 108 // 5 results, no suggestedIndex 109 // Search 2: 110 // 10 results including suggestedIndex = 6 111 // Expected visible rows during update: 112 // 5 search-1 rows + 5 search-2 rows (the ones before the suggestedIndex row) 113 add_suggestedIndex_task({ 114 search1: { 115 otherCount: 4, 116 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 117 viewCount: 5, 118 }, 119 search2: { 120 otherCount: 10, 121 otherType: UrlbarUtils.RESULT_TYPE.URL, 122 suggestedIndex: 6, 123 viewCount: 10, 124 }, 125 duringUpdate: [ 126 { count: 1 }, 127 { count: 4, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 128 { count: 5, type: UrlbarUtils.RESULT_TYPE.URL }, 129 { 130 count: 1, 131 type: UrlbarUtils.RESULT_TYPE.URL, 132 suggestedIndex: 6, 133 hidden: true, 134 }, 135 { count: 3, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 136 ], 137 }); 138 139 // Search 1: 140 // 5 results, no suggestedIndex 141 // Search 2: 142 // 10 results including suggestedIndex = 8 143 // Expected visible rows during update: 144 // 5 search-1 rows + 5 search-2 rows (some of the ones before the 145 // suggestedIndex) 146 add_suggestedIndex_task({ 147 search1: { 148 otherCount: 4, 149 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 150 viewCount: 5, 151 }, 152 search2: { 153 otherCount: 10, 154 otherType: UrlbarUtils.RESULT_TYPE.URL, 155 suggestedIndex: 8, 156 viewCount: 10, 157 }, 158 duringUpdate: [ 159 { count: 1 }, 160 { count: 4, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 161 { count: 5, type: UrlbarUtils.RESULT_TYPE.URL }, 162 { count: 2, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 163 { 164 count: 1, 165 type: UrlbarUtils.RESULT_TYPE.URL, 166 suggestedIndex: 8, 167 hidden: true, 168 }, 169 { count: 1, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 170 ], 171 }); 172 173 // Search 1: 174 // 5 results, no suggestedIndex 175 // Search 2: 176 // 10 results including suggestedIndex = 9 177 // Expected visible rows during update: 178 // 5 search-1 rows + 5 search-2 rows (some of the ones before the 179 // suggestedIndex) 180 add_suggestedIndex_task({ 181 search1: { 182 otherCount: 4, 183 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 184 viewCount: 5, 185 }, 186 search2: { 187 otherCount: 10, 188 otherType: UrlbarUtils.RESULT_TYPE.URL, 189 suggestedIndex: 9, 190 viewCount: 10, 191 }, 192 duringUpdate: [ 193 { count: 1 }, 194 { count: 4, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 195 { count: 5, type: UrlbarUtils.RESULT_TYPE.URL }, 196 { count: 3, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 197 { 198 count: 1, 199 type: UrlbarUtils.RESULT_TYPE.URL, 200 suggestedIndex: 9, 201 hidden: true, 202 }, 203 ], 204 }); 205 206 // Search 1: 207 // 5 results, no suggestedIndex 208 // Search 2: 209 // 10 results including suggestedIndex = -1 210 // Expected visible rows during update: 211 // 5 search-1 rows + 5 search-2 rows 212 add_suggestedIndex_task({ 213 search1: { 214 otherCount: 4, 215 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 216 viewCount: 5, 217 }, 218 search2: { 219 otherCount: 10, 220 otherType: UrlbarUtils.RESULT_TYPE.URL, 221 suggestedIndex: -1, 222 viewCount: 10, 223 }, 224 duringUpdate: [ 225 { count: 1 }, 226 { count: 4, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 227 { count: 5, type: UrlbarUtils.RESULT_TYPE.URL }, 228 { count: 3, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 229 { 230 count: 1, 231 type: UrlbarUtils.RESULT_TYPE.URL, 232 suggestedIndex: -1, 233 hidden: true, 234 }, 235 ], 236 }); 237 238 // Search 1: 239 // 5 results, no suggestedIndex 240 // Search 2: 241 // 10 results including suggestedIndex = -2 242 // Expected visible rows during update: 243 // 5 search-1 rows + 5 search-2 rows 244 add_suggestedIndex_task({ 245 search1: { 246 otherCount: 4, 247 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 248 viewCount: 5, 249 }, 250 search2: { 251 otherCount: 10, 252 otherType: UrlbarUtils.RESULT_TYPE.URL, 253 suggestedIndex: -2, 254 viewCount: 10, 255 }, 256 duringUpdate: [ 257 { count: 1 }, 258 { count: 4, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 259 { count: 5, type: UrlbarUtils.RESULT_TYPE.URL }, 260 { count: 2, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 261 { 262 count: 1, 263 type: UrlbarUtils.RESULT_TYPE.URL, 264 suggestedIndex: -2, 265 hidden: true, 266 }, 267 { count: 1, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 268 ], 269 }); 270 271 // Search 1: 272 // 5 results, no suggestedIndex 273 // Search 2: 274 // 10 results including suggestedIndex = -4 275 // Expected visible rows during update: 276 // 5 search-1 rows + 5 search-2 rows 277 add_suggestedIndex_task({ 278 search1: { 279 otherCount: 4, 280 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 281 viewCount: 5, 282 }, 283 search2: { 284 otherCount: 10, 285 otherType: UrlbarUtils.RESULT_TYPE.URL, 286 suggestedIndex: -4, 287 viewCount: 10, 288 }, 289 duringUpdate: [ 290 { count: 1 }, 291 { count: 4, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 292 { count: 5, type: UrlbarUtils.RESULT_TYPE.URL }, 293 { 294 count: 1, 295 type: UrlbarUtils.RESULT_TYPE.URL, 296 suggestedIndex: -4, 297 hidden: true, 298 }, 299 { count: 3, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 300 ], 301 }); 302 303 // Search 1: 304 // 5 results, no suggestedIndex 305 // Search 2: 306 // 10 results including suggestedIndex = -6 307 // Expected visible rows during update: 308 // 5 search-1 rows + 3 search-2 rows (the ones before the suggestedIndex row) 309 add_suggestedIndex_task({ 310 search1: { 311 otherCount: 4, 312 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 313 viewCount: 5, 314 }, 315 search2: { 316 otherCount: 10, 317 otherType: UrlbarUtils.RESULT_TYPE.URL, 318 suggestedIndex: -6, 319 viewCount: 10, 320 }, 321 duringUpdate: [ 322 { count: 1 }, 323 { count: 4, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 324 { count: 3, type: UrlbarUtils.RESULT_TYPE.URL }, 325 { 326 count: 1, 327 type: UrlbarUtils.RESULT_TYPE.URL, 328 suggestedIndex: -6, 329 hidden: true, 330 }, 331 { count: 5, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 332 ], 333 }); 334 335 // Search 1: 336 // 5 results, no suggestedIndex 337 // Search 2: 338 // 10 results including suggestedIndex = -8 339 // Expected visible rows during update: 340 // 5 search-1 rows + 1 search-2 row (the one before the suggestedIndex row) 341 add_suggestedIndex_task({ 342 search1: { 343 otherCount: 4, 344 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 345 viewCount: 5, 346 }, 347 search2: { 348 otherCount: 10, 349 otherType: UrlbarUtils.RESULT_TYPE.URL, 350 suggestedIndex: -8, 351 viewCount: 10, 352 }, 353 duringUpdate: [ 354 { count: 1 }, 355 { count: 4, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 356 { count: 1, type: UrlbarUtils.RESULT_TYPE.URL }, 357 { 358 count: 1, 359 type: UrlbarUtils.RESULT_TYPE.URL, 360 suggestedIndex: -8, 361 hidden: true, 362 }, 363 { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 364 ], 365 }); 366 367 // Search 1: 368 // 5 results including suggestedIndex = 1 369 // Search 2: 370 // 10 results including suggestedIndex = 1 371 // Expected visible rows during update: 372 // 5 search-1 rows + 5 search-2 rows 373 add_suggestedIndex_task({ 374 search1: { 375 otherCount: 3, 376 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 377 suggestedIndex: 1, 378 viewCount: 5, 379 }, 380 search2: { 381 otherCount: 10, 382 otherType: UrlbarUtils.RESULT_TYPE.URL, 383 suggestedIndex: 1, 384 viewCount: 10, 385 }, 386 duringUpdate: [ 387 { count: 1 }, 388 { 389 count: 1, 390 type: UrlbarUtils.RESULT_TYPE.URL, 391 suggestedIndex: 1, 392 }, 393 { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 394 { count: 5, type: UrlbarUtils.RESULT_TYPE.URL }, 395 { count: 3, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 396 ], 397 }); 398 399 // Search 1: 400 // 5 results including suggestedIndex = 1 401 // Search 2: 402 // 10 results including suggestedIndex = 2 403 // Expected visible rows during update: 404 // 5 original rows with no changes 405 add_suggestedIndex_task({ 406 search1: { 407 otherCount: 3, 408 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 409 suggestedIndex: 1, 410 viewCount: 5, 411 }, 412 search2: { 413 otherCount: 10, 414 otherType: UrlbarUtils.RESULT_TYPE.URL, 415 suggestedIndex: 2, 416 viewCount: 10, 417 }, 418 duringUpdate: [ 419 { count: 1 }, 420 { 421 count: 1, 422 type: UrlbarUtils.RESULT_TYPE.URL, 423 suggestedIndex: 1, 424 stale: true, 425 }, 426 { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 427 { count: 1, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 428 { 429 count: 1, 430 type: UrlbarUtils.RESULT_TYPE.URL, 431 suggestedIndex: 2, 432 hidden: true, 433 }, 434 { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 435 ], 436 }); 437 438 // Search 1: 439 // 5 results including suggestedIndex = 1 440 // Search 2: 441 // 10 results including suggestedIndex = 9 442 // Expected visible rows during update: 443 // 5 original rows with no changes 444 add_suggestedIndex_task({ 445 search1: { 446 otherCount: 3, 447 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 448 suggestedIndex: 1, 449 viewCount: 5, 450 }, 451 search2: { 452 otherCount: 10, 453 otherType: UrlbarUtils.RESULT_TYPE.URL, 454 suggestedIndex: 9, 455 viewCount: 10, 456 }, 457 duringUpdate: [ 458 { count: 1 }, 459 { 460 count: 1, 461 type: UrlbarUtils.RESULT_TYPE.URL, 462 suggestedIndex: 1, 463 stale: true, 464 }, 465 { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 466 { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 467 { 468 count: 1, 469 type: UrlbarUtils.RESULT_TYPE.URL, 470 suggestedIndex: 9, 471 hidden: true, 472 }, 473 ], 474 }); 475 476 // Search 1: 477 // 5 results including suggestedIndex = 1 478 // Search 2: 479 // 10 results including suggestedIndex = -1 480 // Expected visible rows during update: 481 // 5 original rows with no changes 482 add_suggestedIndex_task({ 483 search1: { 484 otherCount: 3, 485 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 486 suggestedIndex: 1, 487 viewCount: 5, 488 }, 489 search2: { 490 otherCount: 10, 491 otherType: UrlbarUtils.RESULT_TYPE.URL, 492 suggestedIndex: -1, 493 viewCount: 10, 494 }, 495 duringUpdate: [ 496 { count: 1 }, 497 { 498 count: 1, 499 type: UrlbarUtils.RESULT_TYPE.URL, 500 suggestedIndex: 1, 501 stale: true, 502 }, 503 { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 504 { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 505 { 506 count: 1, 507 type: UrlbarUtils.RESULT_TYPE.URL, 508 suggestedIndex: -1, 509 hidden: true, 510 }, 511 ], 512 }); 513 514 // Search 1: 515 // 5 results including suggestedIndex = 1 516 // Search 2: 517 // 10 results including suggestedIndex = -2 518 // Expected visible rows during update: 519 // 5 original rows with no changes 520 add_suggestedIndex_task({ 521 search1: { 522 otherCount: 3, 523 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 524 suggestedIndex: 1, 525 viewCount: 5, 526 }, 527 search2: { 528 otherCount: 10, 529 otherType: UrlbarUtils.RESULT_TYPE.URL, 530 suggestedIndex: -2, 531 viewCount: 10, 532 }, 533 duringUpdate: [ 534 { count: 1 }, 535 { 536 count: 1, 537 type: UrlbarUtils.RESULT_TYPE.URL, 538 suggestedIndex: 1, 539 stale: true, 540 }, 541 { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 542 { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 543 { 544 count: 1, 545 type: UrlbarUtils.RESULT_TYPE.URL, 546 suggestedIndex: -2, 547 hidden: true, 548 }, 549 { count: 1, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 550 ], 551 }); 552 553 // Search 1: 554 // 5 results including suggestedIndex = 1 555 // Search 2: 556 // 10 results including suggestedIndex = -9 557 // Expected visible rows during update: 558 // 5 original rows with no changes 559 add_suggestedIndex_task({ 560 search1: { 561 otherCount: 3, 562 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 563 suggestedIndex: 1, 564 viewCount: 5, 565 }, 566 search2: { 567 otherCount: 10, 568 otherType: UrlbarUtils.RESULT_TYPE.URL, 569 suggestedIndex: -9, 570 viewCount: 10, 571 }, 572 duringUpdate: [ 573 { count: 1 }, 574 { 575 count: 1, 576 type: UrlbarUtils.RESULT_TYPE.URL, 577 suggestedIndex: 1, 578 stale: true, 579 }, 580 { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 581 { 582 count: 1, 583 type: UrlbarUtils.RESULT_TYPE.URL, 584 suggestedIndex: -9, 585 hidden: true, 586 }, 587 { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 588 ], 589 }); 590 591 // Search 1: 592 // 5 results including suggestedIndex = 9 593 // Search 2: 594 // 10 results including suggestedIndex = 1 595 // Expected visible rows during update: 596 // 5 original rows with no changes 597 add_suggestedIndex_task({ 598 search1: { 599 otherCount: 3, 600 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 601 suggestedIndex: 9, 602 viewCount: 5, 603 }, 604 search2: { 605 otherCount: 10, 606 otherType: UrlbarUtils.RESULT_TYPE.URL, 607 suggestedIndex: 1, 608 viewCount: 10, 609 }, 610 duringUpdate: [ 611 { count: 1 }, 612 { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 613 { 614 count: 1, 615 type: UrlbarUtils.RESULT_TYPE.URL, 616 suggestedIndex: 9, 617 stale: true, 618 }, 619 { 620 count: 1, 621 type: UrlbarUtils.RESULT_TYPE.URL, 622 suggestedIndex: 1, 623 hidden: true, 624 }, 625 { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 626 ], 627 }); 628 629 // Search 1: 630 // 5 results including suggestedIndex = 9 631 // Search 2: 632 // 10 results including suggestedIndex = 3 633 // Expected visible rows during update: 634 // 5 original rows with no changes 635 add_suggestedIndex_task({ 636 search1: { 637 otherCount: 3, 638 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 639 suggestedIndex: 9, 640 viewCount: 5, 641 }, 642 search2: { 643 otherCount: 10, 644 otherType: UrlbarUtils.RESULT_TYPE.URL, 645 suggestedIndex: 3, 646 viewCount: 10, 647 }, 648 duringUpdate: [ 649 { count: 1 }, 650 { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 651 { 652 count: 1, 653 type: UrlbarUtils.RESULT_TYPE.URL, 654 suggestedIndex: 9, 655 stale: true, 656 }, 657 { count: 2, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 658 { 659 count: 1, 660 type: UrlbarUtils.RESULT_TYPE.URL, 661 suggestedIndex: 3, 662 hidden: true, 663 }, 664 { count: 6, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 665 ], 666 }); 667 668 // Search 1: 669 // 5 results including suggestedIndex = 9 670 // Search 2: 671 // 10 results including suggestedIndex = 9 672 // Expected visible rows during update: 673 // 5 original rows with no changes 674 add_suggestedIndex_task({ 675 search1: { 676 otherCount: 3, 677 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 678 suggestedIndex: 9, 679 viewCount: 5, 680 }, 681 search2: { 682 otherCount: 10, 683 otherType: UrlbarUtils.RESULT_TYPE.URL, 684 suggestedIndex: 9, 685 viewCount: 10, 686 }, 687 duringUpdate: [ 688 { count: 1 }, 689 { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 690 { 691 count: 1, 692 type: UrlbarUtils.RESULT_TYPE.URL, 693 suggestedIndex: 9, 694 stale: true, 695 }, 696 { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 697 { 698 count: 1, 699 type: UrlbarUtils.RESULT_TYPE.URL, 700 suggestedIndex: 9, 701 hidden: true, 702 }, 703 ], 704 }); 705 706 // Search 1: 707 // 5 results including suggestedIndex = 9 708 // Search 2: 709 // 10 results including suggestedIndex = -1 710 // Expected visible rows during update: 711 // 5 original rows with no changes 712 add_suggestedIndex_task({ 713 search1: { 714 otherCount: 3, 715 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 716 suggestedIndex: 9, 717 viewCount: 5, 718 }, 719 search2: { 720 otherCount: 10, 721 otherType: UrlbarUtils.RESULT_TYPE.URL, 722 suggestedIndex: -1, 723 viewCount: 10, 724 }, 725 duringUpdate: [ 726 { count: 1 }, 727 { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 728 { 729 count: 1, 730 type: UrlbarUtils.RESULT_TYPE.URL, 731 suggestedIndex: 9, 732 stale: true, 733 }, 734 { count: 8, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 735 { 736 count: 1, 737 type: UrlbarUtils.RESULT_TYPE.URL, 738 suggestedIndex: -1, 739 hidden: true, 740 }, 741 ], 742 }); 743 744 // Search 1: 745 // 5 results including suggestedIndex = 9 746 // Search 2: 747 // 10 results including suggestedIndex = -7 748 // Expected visible rows during update: 749 // 5 original rows with no changes 750 add_suggestedIndex_task({ 751 search1: { 752 otherCount: 3, 753 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 754 suggestedIndex: 9, 755 viewCount: 5, 756 }, 757 search2: { 758 otherCount: 10, 759 otherType: UrlbarUtils.RESULT_TYPE.URL, 760 suggestedIndex: -7, 761 viewCount: 10, 762 }, 763 duringUpdate: [ 764 { count: 1 }, 765 { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 766 { 767 count: 1, 768 type: UrlbarUtils.RESULT_TYPE.URL, 769 suggestedIndex: 9, 770 stale: true, 771 }, 772 { count: 2, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 773 { 774 count: 1, 775 type: UrlbarUtils.RESULT_TYPE.URL, 776 suggestedIndex: -7, 777 hidden: true, 778 }, 779 { count: 6, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 780 ], 781 }); 782 783 // Search 1: 784 // 5 results, no suggestedIndex 785 // Search 2: 786 // 10 results including suggestedIndex = 1 and suggestedIndex = -1 787 // Expected visible rows during update: 788 // 5 original rows with no changes 789 add_suggestedIndex_task({ 790 search1: { 791 otherCount: 4, 792 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 793 viewCount: 5, 794 }, 795 search2: { 796 otherCount: 10, 797 otherType: UrlbarUtils.RESULT_TYPE.URL, 798 suggestedIndexes: [1, -1], 799 viewCount: 10, 800 }, 801 duringUpdate: [ 802 { count: 1 }, 803 { count: 4, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 804 { 805 count: 1, 806 type: UrlbarUtils.RESULT_TYPE.URL, 807 suggestedIndex: 1, 808 hidden: true, 809 }, 810 { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 811 { 812 count: 1, 813 type: UrlbarUtils.RESULT_TYPE.URL, 814 suggestedIndex: -1, 815 hidden: true, 816 }, 817 ], 818 }); 819 820 // Search 1: 821 // 5 results including suggestedIndex = 1 822 // Search 2: 823 // 10 results including suggestedIndex = 1 and suggestedIndex = -1 824 // Expected visible rows during update: 825 // 5 search-1 rows + 5 search-2 rows (some of the ones before the 826 // suggestedIndex) 827 add_suggestedIndex_task({ 828 search1: { 829 otherCount: 3, 830 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 831 suggestedIndex: 1, 832 viewCount: 5, 833 }, 834 search2: { 835 otherCount: 10, 836 otherType: UrlbarUtils.RESULT_TYPE.URL, 837 suggestedIndexes: [1, -1], 838 viewCount: 10, 839 }, 840 duringUpdate: [ 841 { count: 1 }, 842 { 843 count: 1, 844 type: UrlbarUtils.RESULT_TYPE.URL, 845 suggestedIndex: 1, 846 }, 847 { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 848 { count: 5, type: UrlbarUtils.RESULT_TYPE.URL }, 849 { count: 2, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 850 { 851 count: 1, 852 type: UrlbarUtils.RESULT_TYPE.URL, 853 suggestedIndex: -1, 854 hidden: true, 855 }, 856 ], 857 }); 858 859 // Search 1: 860 // 5 results including suggestedIndex = -1 861 // Search 2: 862 // 10 results including suggestedIndex = 1 and suggestedIndex = -1 863 // Expected visible rows during update: 864 // 5 original rows with no changes 865 add_suggestedIndex_task({ 866 search1: { 867 otherCount: 3, 868 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 869 suggestedIndex: -1, 870 viewCount: 5, 871 }, 872 search2: { 873 otherCount: 10, 874 otherType: UrlbarUtils.RESULT_TYPE.URL, 875 suggestedIndexes: [1, -1], 876 viewCount: 10, 877 }, 878 duringUpdate: [ 879 { count: 1 }, 880 { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 881 { 882 count: 1, 883 type: UrlbarUtils.RESULT_TYPE.URL, 884 suggestedIndex: -1, 885 stale: true, 886 }, 887 { 888 count: 1, 889 type: UrlbarUtils.RESULT_TYPE.URL, 890 suggestedIndex: 1, 891 hidden: true, 892 }, 893 { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 894 { 895 count: 1, 896 type: UrlbarUtils.RESULT_TYPE.URL, 897 suggestedIndex: -1, 898 hidden: true, 899 }, 900 ], 901 }); 902 903 // Search 1: 904 // 5 results, no suggestedIndex 905 // Search 2: 906 // 9 results including suggestedIndex = 1 with resultSpan = 2 907 // Expected visible rows during update: 908 // 5 original rows with no changes 909 add_suggestedIndex_task({ 910 search1: { 911 otherCount: 4, 912 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 913 viewCount: 5, 914 }, 915 search2: { 916 otherCount: 10, 917 otherType: UrlbarUtils.RESULT_TYPE.URL, 918 suggestedIndex: 1, 919 resultSpan: 2, 920 viewCount: 9, 921 }, 922 duringUpdate: [ 923 { count: 1 }, 924 { count: 4, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 925 { 926 count: 1, 927 type: UrlbarUtils.RESULT_TYPE.URL, 928 suggestedIndex: 1, 929 resultSpan: 2, 930 hidden: true, 931 }, 932 { count: 7, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 933 ], 934 }); 935 936 // Search 1: 937 // 5 results, no suggestedIndex 938 // Search 2: 939 // 9 results including: 940 // suggestedIndex = 1 with resultSpan = 2 941 // suggestedIndex = -1 942 // Expected visible rows during update: 943 // 5 original rows with no changes 944 add_suggestedIndex_task({ 945 search1: { 946 otherCount: 4, 947 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 948 viewCount: 5, 949 }, 950 search2: { 951 otherCount: 10, 952 otherType: UrlbarUtils.RESULT_TYPE.URL, 953 suggestedIndexes: [[1, 2], -1], 954 viewCount: 9, 955 }, 956 duringUpdate: [ 957 { count: 1 }, 958 { count: 4, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 959 { 960 count: 1, 961 type: UrlbarUtils.RESULT_TYPE.URL, 962 suggestedIndex: 1, 963 resultSpan: 2, 964 hidden: true, 965 }, 966 { count: 6, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 967 { 968 count: 1, 969 type: UrlbarUtils.RESULT_TYPE.URL, 970 suggestedIndex: -1, 971 hidden: true, 972 }, 973 ], 974 }); 975 976 // Search 1: 977 // 5 results including suggestedIndex = 1 with resultSpan = 2 978 // Search 2: 979 // 9 results including: 980 // suggestedIndex = 1 with resultSpan = 2 981 // suggestedIndex = -1 982 // Expected visible rows during update: 983 // 5 search-1 rows + 4 search-2 rows 984 add_suggestedIndex_task({ 985 search1: { 986 otherCount: 3, 987 otherType: UrlbarUtils.RESULT_TYPE.SEARCH, 988 suggestedIndexes: [[1, 2]], 989 viewCount: 5, 990 }, 991 search2: { 992 otherCount: 10, 993 otherType: UrlbarUtils.RESULT_TYPE.URL, 994 suggestedIndexes: [[1, 2], -1], 995 viewCount: 9, 996 }, 997 duringUpdate: [ 998 { count: 1 }, 999 { 1000 count: 1, 1001 type: UrlbarUtils.RESULT_TYPE.URL, 1002 suggestedIndex: 1, 1003 resultSpan: 2, 1004 }, 1005 { count: 3, type: UrlbarUtils.RESULT_TYPE.SEARCH, stale: true }, 1006 { count: 4, type: UrlbarUtils.RESULT_TYPE.URL }, 1007 { count: 2, type: UrlbarUtils.RESULT_TYPE.URL, hidden: true }, 1008 { 1009 count: 1, 1010 type: UrlbarUtils.RESULT_TYPE.URL, 1011 suggestedIndex: -1, 1012 hidden: true, 1013 }, 1014 ], 1015 });