B2G/gecko/toolkit/components/places/tests/unit/test_history_sidebar.js
/**
 * Fills history and checks containers' labels.
 */
Fills history and checks containers' labels.
Fills history and checks containers ' labels .
function fill_history() {
  print("\n\n*** TEST Fill History\n");
  for (var i = 0; i < containers.length; i++) {
    var container = containers[i];
    var testURI = uri("http://mirror"+i+".mozilla.com/b");
    add_normalized_visit(testURI, nowObj.getTime(), container.offset);
    var testURI = uri("http://mirror"+i+".mozilla.com/a");
    add_normalized_visit(testURI, nowObj.getTime(), container.offset);
    var testURI = uri("http://mirror"+i+".google.com/b");
    add_normalized_visit(testURI, nowObj.getTime(), container.offset);
    var testURI = uri("http://mirror"+i+".google.com/a");
    add_normalized_visit(testURI, nowObj.getTime(), container.offset);
    check_visit(container.offset);
  }
  var options = hs.getNewQueryOptions();
  options.resultType = options.RESULTS_AS_DATE_SITE_QUERY;
  var query = hs.getNewQuery();
  var result = hs.executeQuery(query, options);
  var root = result.root;
  root.containerOpen = true;
  var cc = root.childCount;
  print("Found containers:");
  var previousLabels = [];
  for (var i = 0; i < cc; i++) {
    var container = visibleContainers[i];
    var node = root.getChild(i);
    print(node.title);
    if (container.label)
      do_check_eq(node.title, container.label);
    do_check_eq(previousLabels.indexOf(node.title), -1);
    previousLabels.push(node.title);
  }
  do_check_eq(cc, visibleContainers.length);
  root.containerOpen = false;
}
function fill_history ( ) { print ( "\n\n*** TEST Fill History\n" ) ; for ( var i = 0 ; i < containers . length ; i ++ ) { var container = containers [ i ] ; var testURI = uri ( "http://mirror" + i + ".mozilla.com/b" ) ; add_normalized_visit ( testURI , nowObj . getTime ( ) , container . offset ) ; var testURI = uri ( "http://mirror" + i + ".mozilla.com/a" ) ; add_normalized_visit ( testURI , nowObj . getTime ( ) , container . offset ) ; var testURI = uri ( "http://mirror" + i + ".google.com/b" ) ; add_normalized_visit ( testURI , nowObj . getTime ( ) , container . offset ) ; var testURI = uri ( "http://mirror" + i + ".google.com/a" ) ; add_normalized_visit ( testURI , nowObj . getTime ( ) , container . offset ) ; check_visit ( container . offset ) ; } var options = hs . getNewQueryOptions ( ) ; options . resultType = options . RESULTS_AS_DATE_SITE_QUERY ; var query = hs . getNewQuery ( ) ; var result = hs . executeQuery ( query , options ) ; var root = result . root ; root . containerOpen = true ; var cc = root . childCount ; print ( "Found containers:" ) ; var previousLabels = [ ] ; for ( var i = 0 ; i < cc ; i ++ ) { var container = visibleContainers [ i ] ; var node = root . getChild ( i ) ; print ( node . title ) ; if ( container . label ) do_check_eq ( node . title , container . label ) ; do_check_eq ( previousLabels . indexOf ( node . title ) , - 1 ) ; previousLabels . push ( node . title ) ; } do_check_eq ( cc , visibleContainers . length ) ; root . containerOpen = false ; }
Fills history and checks containers' labels.
Fills history and checks containers ' labels .
// We can't use "now" because our hardcoded offsets would be invalid for some // date.  So we hardcode a date. // Bug 485703 - Hide date containers not containing additional entries //              compared to previous ones. // Check after every new container is added. // Check labels are not repeated.