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