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