blob: d7ba435d763cfcd3f95e8fc8a93bb4789811c4b3 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var {
assertExpectedMessagesIndexed,
glodaTestHelperInitialize,
waitForGlodaIndexer,
} = ChromeUtils.import("resource://testing-common/gloda/GlodaTestHelper.jsm");
var { MessageGenerator } = ChromeUtils.import(
"resource://testing-common/mailnews/MessageGenerator.jsm"
);
var { MessageInjection } = ChromeUtils.import(
"resource://testing-common/mailnews/MessageInjection.jsm"
);
/*
* Test gloda starts up with indexing suppressed when offline at startup.
*/
var messageInjection;
add_setup(async function () {
// We must do this before the first load otherwise gloda is started without
// picking up the necessary initialisation.
Services.io.manageOfflineStatus = false;
Services.io.offline = true;
let msgGen = new MessageGenerator();
messageInjection = new MessageInjection({ mode: "local" }, msgGen);
glodaTestHelperInitialize(messageInjection);
});
/**
* Make sure that if we have to reparse a local folder we do not hang or
* anything. (We had a regression where we would hang.)
*/
add_task(async function test_gloda_offline_startup() {
// Set up a folder for indexing and check the message doesn't get indexed.
let [, msgSet] = await messageInjection.makeFoldersWithSets(1, [
{ count: 1 },
]);
await waitForGlodaIndexer();
Assert.ok(...assertExpectedMessagesIndexed([]));
// Now go online...
Services.io.offline = false;
// ...and check we have done the indexing and indexed the message.
await waitForGlodaIndexer();
Assert.ok(...assertExpectedMessagesIndexed([msgSet]));
});
|