mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-13 21:35:39 +00:00
Bug 744698 - Force logging. r=gavin, a=test-only
This commit is contained in:
parent
bb3c40904f
commit
a2158aa44d
@ -23,6 +23,7 @@ do_load_httpd_js();
|
||||
|
||||
function run_test()
|
||||
{
|
||||
do_print("Preparing test");
|
||||
removeMetadata();
|
||||
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "2");
|
||||
do_load_manifest("data/chrome.manifest");
|
||||
@ -33,17 +34,22 @@ function run_test()
|
||||
|
||||
let search = Services.search;
|
||||
|
||||
do_print("Setting up observer");
|
||||
function observer(aSubject, aTopic, aData) {
|
||||
do_print("Observing topic " + aTopic);
|
||||
if ("engine-added" == aData) {
|
||||
let engine1 = search.getEngineByName("Test search engine");
|
||||
let engine2 = search.getEngineByName("Sherlock test search engine");
|
||||
dumpn("Got engine 2: "+engine2);
|
||||
do_print("Currently, engine1 is " + engine1);
|
||||
do_print("Currently, engine2 is " + engine2);
|
||||
if(engine1 && engine2)
|
||||
{
|
||||
search.moveEngine(engine1, 0);
|
||||
search.moveEngine(engine2, 1);
|
||||
do_print("Next step is forcing flush");
|
||||
do_timeout(0,
|
||||
function() {
|
||||
do_print("Forcing flush");
|
||||
// Force flush
|
||||
// Note: the timeout is needed, to avoid some reentrency
|
||||
// issues in nsSearchService.
|
||||
@ -53,19 +59,22 @@ function run_test()
|
||||
afterCommit(
|
||||
function()
|
||||
{
|
||||
do_print("Commit complete");
|
||||
// Check that search-metadata.json has been created
|
||||
let metadata = gProfD.clone();
|
||||
metadata.append("search-metadata.json");
|
||||
do_check_true(metadata.exists());
|
||||
|
||||
// Check that the entries are placed as specified correctly
|
||||
let stream = NetUtil.newChannel(metadata).open();
|
||||
let stream = NetUtil.newChannel(metadata).open();
|
||||
let json = parseJsonFromStream(stream);
|
||||
do_check_eq(json["[app]/test-search-engine.xml"].order, 1);
|
||||
do_check_eq(json["[profile]/sherlock-test-search-engine.xml"].order, 2);
|
||||
httpServer.stop(function() {});
|
||||
stream.close(); // Stream must be closed under Windows
|
||||
removeMetadata();
|
||||
|
||||
do_print("Cleaning up");
|
||||
httpServer.stop(function() {});
|
||||
stream.close(); // Stream must be closed under Windows
|
||||
removeMetadata();
|
||||
do_test_finished();
|
||||
}
|
||||
);
|
||||
@ -84,4 +93,8 @@ function run_test()
|
||||
Ci.nsISearchEngine.DATA_TEXT,
|
||||
"http://localhost:4444/data/ico-size-16x16-png.ico",
|
||||
false);
|
||||
|
||||
do_timeout(120000, function() {
|
||||
do_throw("Timeout");
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user