Sha256: 25d443070caeecbf354253e16551d0be77f66e67351a5eb2dd4fc4dd01944837
Contents?: true
Size: 1.61 KB
Versions: 2
Compression:
Stored size: 1.61 KB
Contents
require 'kraken-mobile/models/device' class WebDevice < Device #------------------------------- # Signaling #------------------------------- def create_inbox file = File.open(inbox_file_path, 'w') file.close end def delete_inbox return unless File.exist? inbox_file_path File.delete(inbox_file_path) end def write_signal(signal) File.open(inbox_file_path, 'a') do |file| file.puts(signal) end end def read_signal(signal, timeout = K::DEFAULT_TIMEOUT_SECONDS) Timeout.timeout(timeout, RuntimeError) do sleep(1) until inbox_last_signal == signal end end #------------------------------- # More interface methods #------------------------------- def connected? true end def orientation K::WEB_PORTRAIT end def screen_size height = 0 width = 0 [height, width] end def sdk_version 1.0 # Default end def type K::WEB_DEVICE end #------------------------------- # Random testing #------------------------------- def run_monkey_with_number_of_events(number_of_events) number_of_events # TODO, implement end def run_kraken_monkey_with_number_of_events(number_of_events) number_of_events # TODO, implement end #------------------------------- # Helpers #------------------------------- def self.factory_create WebDevice.new( id: SecureRandom.hex(10), model: 'Web' ) end private def inbox_file_path ".#{@id}_#{K::INBOX_FILE_NAME}" end def inbox_last_signal file = File.open(inbox_file_path) lines = file.to_a file.close lines.last&.strip end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
kraken-mobile-1.0.9 | lib/kraken-mobile/models/web_device.rb |
kraken-mobile-1.0.8 | lib/kraken-mobile/models/web_device.rb |