Bug 572223 - too much cookies.sqlite io. Part 8: test write + close + read combination.

This commit is contained in:
Dan Witte 2010-08-02 17:03:25 -07:00
Родитель b21e5ff262
Коммит 71afaa06a5
1 изменённых файлов: 28 добавлений и 1 удалений

Просмотреть файл

@ -50,6 +50,32 @@ function do_run_test() {
do_check_eq(Services.cookiemgr.countCookiesFromHost(host), 1);
}
// reload again, to make sure the additions were written correctly
do_close_profile(test_generator);
yield;
do_load_profile();
// remove some of the cookies, in both reverse and forward order
for (let i = 100; i-- > 0; ) {
let host = i.toString() + ".com";
Services.cookiemgr.remove(host, "oh", "/", false);
}
for (let i = 2900; i < 3000; ++i) {
let host = i.toString() + ".com";
Services.cookiemgr.remove(host, "oh", "/", false);
}
// check the count
do_check_eq(do_count_cookies(), 2800);
// reload again, to make sure the removals were written correctly
do_close_profile(test_generator);
yield;
do_load_profile();
// check the count
do_check_eq(do_count_cookies(), 2800);
// reload again, but wait for async read completion
do_close_profile(test_generator);
yield;
@ -57,7 +83,8 @@ function do_run_test() {
yield;
// check that everything's precisely correct
for (let i = 0; i < 3000; ++i) {
do_check_eq(do_count_cookies(), 2800);
for (let i = 100; i < 2900; ++i) {
let host = i.toString() + ".com";
do_check_eq(Services.cookiemgr.countCookiesFromHost(host), 1);
}