зеркало из https://github.com/mozilla/gecko-dev.git
Bug 774223: Make get_logs clear the log file when called; r=mdas
This commit is contained in:
Родитель
ff075de849
Коммит
fe68f5e78e
|
@ -10,18 +10,27 @@ class TestLog(MarionetteTestCase):
|
|||
self.marionette.log("I am info")
|
||||
self.assertTrue("I am info" in self.marionette.get_logs()[0])
|
||||
self.marionette.log("I AM ERROR", "ERROR")
|
||||
self.assertTrue("I AM ERROR" in self.marionette.get_logs()[1])
|
||||
self.assertTrue("I AM ERROR" in self.marionette.get_logs()[0])
|
||||
|
||||
def test_that_we_can_clear_the_logs(self):
|
||||
self.marionette.log("I am info")
|
||||
self.assertTrue("I am info" in self.marionette.get_logs()[0])
|
||||
self.marionette.log("I AM ERROR", "ERROR")
|
||||
self.assertTrue("I AM ERROR" in self.marionette.get_logs()[0])
|
||||
|
||||
# Check that is empty if we call it again
|
||||
self.assertEqual(0, len(self.marionette.get_logs()))
|
||||
|
||||
def test_log_script(self):
|
||||
self.marionette.execute_script("log('some log');")
|
||||
self.assertTrue("some log" in self.marionette.get_logs()[0])
|
||||
self.marionette.execute_script("log('some error', 'ERROR');")
|
||||
self.assertTrue("some error" in self.marionette.get_logs()[1])
|
||||
self.assertTrue("some error" in self.marionette.get_logs()[0])
|
||||
self.marionette.set_script_timeout(2000)
|
||||
self.marionette.execute_async_script("log('some more logs'); finish();")
|
||||
self.assertTrue("some more logs" in self.marionette.get_logs()[2])
|
||||
self.assertTrue("some more logs" in self.marionette.get_logs()[0])
|
||||
self.marionette.execute_async_script("log('some more errors', 'ERROR'); finish();")
|
||||
self.assertTrue("some more errors" in self.marionette.get_logs()[3])
|
||||
self.assertTrue("some more errors" in self.marionette.get_logs()[0])
|
||||
|
||||
class TestLogChrome(TestLog):
|
||||
def setUp(self):
|
||||
|
|
|
@ -392,7 +392,7 @@ MarionetteDriverActor.prototype = {
|
|||
getLogs: function MDA_getLogs() {
|
||||
this.sendResponse(this.marionetteLog.getLogs());
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* Log some performance data
|
||||
*/
|
||||
|
|
|
@ -33,7 +33,9 @@ MarionetteLogObj.prototype = {
|
|||
* Return all logged messages.
|
||||
*/
|
||||
getLogs: function ML_getLogs() {
|
||||
return this.logs;
|
||||
let logs = this.logs;
|
||||
this.clearLogs();
|
||||
return logs;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче