This repository has been archived by the owner on Dec 15, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PlacesProvider messages in AboutRemoteNewTab.jsm
- Loading branch information
Showing
3 changed files
with
88 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
browser/components/newtab/tests/xpcshell/test_RemoteAboutNewTab.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
"use strict"; | ||
|
||
/* global XPCOMUtils, RemoteAboutNewTab, PlacesProvider */ | ||
/* global do_get_profile, run_next_test, add_task */ | ||
/* global equal, ok */ | ||
/* exported run_test */ | ||
|
||
const { | ||
utils: Cu, | ||
interfaces: Ci, | ||
} = Components; | ||
|
||
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); | ||
|
||
XPCOMUtils.defineLazyModuleGetter(this, "PlacesProvider", | ||
"resource:///modules/PlacesProvider.jsm"); | ||
|
||
XPCOMUtils.defineLazyModuleGetter(this, "RemoteAboutNewTab", | ||
"resource:///modules/RemoteAboutNewTab.jsm"); | ||
|
||
// ensure a profile exists | ||
do_get_profile(); | ||
|
||
function run_test() { | ||
run_next_test(); | ||
} | ||
|
||
add_task(function* test_PlacesEventListener() { | ||
RemoteAboutNewTab.init(); | ||
let oldPageListener = RemoteAboutNewTab.pageListener; | ||
RemoteAboutNewTab.pageListener = {}; | ||
let promise = new Promise(resolve => { | ||
RemoteAboutNewTab.pageListener.sendAsyncMessage = function(name, data) { | ||
if (name == "NewTab:PlacesClearHistory") { | ||
resolve(); | ||
} | ||
}; | ||
PlacesProvider.links.emit("clearHistory"); | ||
}); | ||
yield promise; | ||
RemoteAboutNewTab.pageListener = oldPageListener; | ||
RemoteAboutNewTab.uninit(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters