1
0
mirror of https://github.com/adobe/brackets.git synced 2024-11-20 09:53:00 +01:00

Use LiveDevelopment.status instead of Inspector.connected()

This commit is contained in:
Randy Edmunds 2013-03-13 16:22:06 -07:00
parent 3c45c69ec9
commit 414a508ea4
2 changed files with 16 additions and 11 deletions

View File

@ -788,6 +788,9 @@ define(function LiveDevelopment(require, exports, module) {
_serverProvider = serverProvider; _serverProvider = serverProvider;
} }
// Initialize exports.status
_setStatus(STATUS_INACTIVE);
// For unit testing // For unit testing
exports._pathToUrl = _pathToUrl; exports._pathToUrl = _pathToUrl;
exports._urlToPath = _urlToPath; exports._urlToPath = _urlToPath;

View File

@ -39,7 +39,6 @@ define(function (require, exports, module) {
LiveDevelopment, LiveDevelopment,
LiveDevServerManager, LiveDevServerManager,
DOMAgent, DOMAgent,
Inspector,
DocumentManager, DocumentManager,
ProjectManager; ProjectManager;
@ -70,7 +69,7 @@ define(function (require, exports, module) {
browserText; browserText;
//verify we aren't currently connected //verify we aren't currently connected
expect(Inspector.connected()).toBeFalsy(); expect(LiveDevelopment.status).toBe(LiveDevelopment.STATUS_INACTIVE);
runs(function () { runs(function () {
waitsForDone(SpecRunnerUtils.openProjectFiles([htmlFile]), "SpecRunnerUtils.openProjectFiles"); waitsForDone(SpecRunnerUtils.openProjectFiles([htmlFile]), "SpecRunnerUtils.openProjectFiles");
@ -134,7 +133,6 @@ define(function (require, exports, module) {
LiveDevelopment = testWindow.brackets.test.LiveDevelopment; LiveDevelopment = testWindow.brackets.test.LiveDevelopment;
LiveDevServerManager = testWindow.brackets.test.LiveDevServerManager; LiveDevServerManager = testWindow.brackets.test.LiveDevServerManager;
DOMAgent = testWindow.brackets.test.DOMAgent; DOMAgent = testWindow.brackets.test.DOMAgent;
Inspector = testWindow.brackets.test.Inspector;
DocumentManager = testWindow.brackets.test.DocumentManager; DocumentManager = testWindow.brackets.test.DocumentManager;
CommandManager = testWindow.brackets.test.CommandManager; CommandManager = testWindow.brackets.test.CommandManager;
Commands = testWindow.brackets.test.Commands; Commands = testWindow.brackets.test.Commands;
@ -151,14 +149,16 @@ define(function (require, exports, module) {
LiveDevelopment.close(); LiveDevelopment.close();
}); });
waitsFor(function () { return !Inspector.connected(); }, "Waiting to close inspector", 10000); waitsFor(function () {
return (LiveDevelopment.status === LiveDevelopment.STATUS_INACTIVE);
}, "Waiting for browser to become inactive", 10000);
SpecRunnerUtils.closeTestWindow(); SpecRunnerUtils.closeTestWindow();
}); });
it("should establish a browser connection for an opened html file", function () { it("should establish a browser connection for an opened html file", function () {
//verify we aren't currently connected //verify we aren't currently connected
expect(Inspector.connected()).toBeFalsy(); expect(LiveDevelopment.status).toBe(LiveDevelopment.STATUS_INACTIVE);
//open a file //open a file
runs(function () { runs(function () {
@ -169,10 +169,12 @@ define(function (require, exports, module) {
runs(function () { runs(function () {
LiveDevelopment.open(); LiveDevelopment.open();
}); });
waitsFor(function () { return Inspector.connected(); }, "Waiting for browser", 10000); waitsFor(function () {
return (LiveDevelopment.status === LiveDevelopment.STATUS_ACTIVE);
}, "Waiting for browser to become active", 10000);
runs(function () { runs(function () {
expect(Inspector.connected()).toBeTruthy(); expect(LiveDevelopment.status).toBe(LiveDevelopment.STATUS_ACTIVE);
var doc = DocumentManager.getOpenDocumentForPath(testPath + "/simple1.html"); var doc = DocumentManager.getOpenDocumentForPath(testPath + "/simple1.html");
//expect(isOpenInBrowser(doc, LiveDevelopment.agents)).toBeTruthy(); //expect(isOpenInBrowser(doc, LiveDevelopment.agents)).toBeTruthy();
@ -184,7 +186,7 @@ define(function (require, exports, module) {
it("should should not start a browser connection for an opened css file", function () { it("should should not start a browser connection for an opened css file", function () {
//verify we aren't currently connected //verify we aren't currently connected
expect(Inspector.connected()).toBeFalsy(); expect(LiveDevelopment.status).toBe(LiveDevelopment.STATUS_INACTIVE);
//open a file //open a file
runs(function () { runs(function () {
@ -200,7 +202,7 @@ define(function (require, exports, module) {
waits(1000); waits(1000);
runs(function () { runs(function () {
expect(Inspector.connected()).toBeFalsy(); expect(LiveDevelopment.status).toBe(LiveDevelopment.STATUS_INACTIVE);
var doc = DocumentManager.getOpenDocumentForPath(testPath + "/simple1.css"); var doc = DocumentManager.getOpenDocumentForPath(testPath + "/simple1.css");
expect(isOpenInBrowser(doc, LiveDevelopment.agents)).toBeFalsy(); expect(isOpenInBrowser(doc, LiveDevelopment.agents)).toBeFalsy();
@ -220,7 +222,7 @@ define(function (require, exports, module) {
browserText; browserText;
//verify we aren't currently connected //verify we aren't currently connected
expect(Inspector.connected()).toBeFalsy(); expect(LiveDevelopment.status).toBe(LiveDevelopment.STATUS_INACTIVE);
var cssOpened = false; var cssOpened = false;
runs(function () { runs(function () {
@ -277,7 +279,7 @@ define(function (require, exports, module) {
htmlDoc; htmlDoc;
// verify we aren't currently connected // verify we aren't currently connected
expect(Inspector.connected()).toBeFalsy(); expect(LiveDevelopment.status).toBe(LiveDevelopment.STATUS_INACTIVE);
var cssOpened = false; var cssOpened = false;
runs(function () { runs(function () {