Move kobo auto-suspension logic out of UIManager (#2933)

This commit is contained in:
Hzj_jie
2017-06-23 10:04:11 -07:00
committed by GitHub
parent c8be27481c
commit 7d2ed4c3d0
16 changed files with 494 additions and 127 deletions

View File

@@ -18,12 +18,11 @@ describe("device module", function()
end
}
require("commonrequire")
package.unloadAll()
end)
before_each(function()
package.loaded['ffi/framebuffer_mxcfb'] = mock_fb
package.loaded['device/kindle/device'] = nil
package.loaded['device/kobo/device'] = nil
mock_input = require('device/input')
stub(mock_input, "open")
stub(os, "getenv")
@@ -171,7 +170,6 @@ describe("device module", function()
stub(Device, "isKobo")
Device.isKobo.returns(true)
local saved_noop = UIManager._resetAutoSuspendTimer
UIManager:init()
ReaderUI:doShowReader(sample_pdf)
@@ -185,9 +183,6 @@ describe("device module", function()
Device.powerd.beforeSuspend:revert()
Device.isKobo:revert()
readerui.onFlushSettings:revert()
UIManager._startAutoSuspend = nil
UIManager._stopAutoSuspend = nil
UIManager._resetAutoSuspendTimer = saved_noop
readerui:onClose()
end)
end)
@@ -251,6 +246,7 @@ describe("device module", function()
end)
it("oasis should interpret orientation event", function()
package.unload('device/kindle/device')
io.open = function(filename, mode)
if filename == "/proc/usid" then
return {