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