コード例 #1
0
 @SmallTest
 @Feature({"Android-ContentProvider"})
 public void testInvalidHierarchy() throws InterruptedException {
   BookmarkNode root = new BookmarkNode(1, Type.FOLDER, "Bookmarks", null, null);
   root.addChild(new BookmarkNode(2, Type.URL, "Google", "http://www.google.com/", root));
   root.addChild(new BookmarkNode(2, Type.URL, "GoogleMaps", "http://maps.google.com/", root));
   assertFalse(internalTestNodeHierarchyParceling(root));
 }
コード例 #2
0
  private static BookmarkNode createMockHierarchy() {
    // Mock hierarchy.
    // + Bookmarks
    //   - Google
    //   - Google maps
    //   + Youtube
    //     + Empty folder
    //     + Some other folder
    //       - Surprised Vader
    //     - Rickroll'D
    BookmarkNode root = new BookmarkNode(1, Type.FOLDER, "Bookmarks", null, null);
    root.addChild(new BookmarkNode(2, Type.URL, "Google", "http://www.google.com/", root));
    root.addChild(new BookmarkNode(3, Type.URL, "GoogleMaps", "http://maps.google.com/", root));

    BookmarkNode folder1 = new BookmarkNode(4, Type.FOLDER, "Youtube", null, root);
    root.addChild(folder1);
    folder1.addChild(new BookmarkNode(5, Type.FOLDER, "Empty folder", null, folder1));

    BookmarkNode folder2 = new BookmarkNode(6, Type.FOLDER, "Some other folder", null, folder1);
    folder1.addChild(folder2);

    folder1.addChild(
        new BookmarkNode(
            7, Type.URL, "RickRoll'D", "http://www.youtube.com/watch?v=oHg5SJYRHA0", folder1));
    folder2.addChild(
        new BookmarkNode(
            8, Type.URL, "Surprised Vader", "http://www.youtube.com/watch?v=9h1swNWgP8Q", folder2));
    return root;
  }