summaryrefslogtreecommitdiffstats
path: root/toolkit/components/places/tests/migration/test_current_from_v24.js
blob: 0561b492292b4c099b6222a9b08b015b5e172557 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

add_task(function* setup() {
  yield setupPlacesDatabase("places_v24.sqlite");
});

add_task(function* database_is_valid() {
  Assert.equal(PlacesUtils.history.databaseStatus,
               PlacesUtils.history.DATABASE_STATUS_UPGRADED);

  let db = yield PlacesUtils.promiseDBConnection();
  Assert.equal((yield db.getSchemaVersion()), CURRENT_SCHEMA_VERSION);
});

add_task(function* test_bookmark_guid_annotation_removed()
{
  yield PlacesUtils.bookmarks.eraseEverything();

  let db = yield PlacesUtils.promiseDBConnection();
  let m = new Map([
    [PlacesUtils.placesRootId, PlacesUtils.bookmarks.rootGuid],
    [PlacesUtils.bookmarksMenuFolderId, PlacesUtils.bookmarks.menuGuid],
    [PlacesUtils.toolbarFolderId, PlacesUtils.bookmarks.toolbarGuid],
    [PlacesUtils.unfiledBookmarksFolderId, PlacesUtils.bookmarks.unfiledGuid],
    [PlacesUtils.tagsFolderId, PlacesUtils.bookmarks.tagsGuid],
    [PlacesUtils.mobileFolderId, PlacesUtils.bookmarks.mobileGuid],
  ]);

  let rows = yield db.execute(`SELECT id, guid FROM moz_bookmarks`);
  for (let row of rows) {
    let id = row.getResultByName("id");
    let guid = row.getResultByName("guid");
    Assert.equal(m.get(id), guid, "The root folder has the correct GUID");
  }
});