testability-driver 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. data/lib/tdriver-devtools/behaviour/xml/rdoc_behaviour_xml_generator.rb +2 -2
  2. data/lib/tdriver-devtools/tdriver-devtools.rb +1 -1
  3. data/lib/tdriver-devtools/tests/feature_tests/lib/custom_rdoc_generator.rb +3 -3
  4. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_composition.rb +6 -1
  5. data/lib/tdriver/base/behaviour/behaviours/object_behaviour_description.rb +5 -3
  6. data/lib/tdriver/base/behaviour/behaviours/object_composition.rb +1 -1
  7. data/lib/tdriver/base/behaviour/factory.rb +225 -225
  8. data/lib/tdriver/base/errors.rb +1 -1
  9. data/lib/tdriver/base/state_object.rb +227 -179
  10. data/lib/tdriver/base/sut/controller.rb +2 -2
  11. data/lib/tdriver/base/sut/factory.rb +190 -182
  12. data/lib/tdriver/base/sut/generic/behaviours/application.rb +69 -25
  13. data/lib/tdriver/base/sut/generic/behaviours/controller.rb +1 -1
  14. data/lib/tdriver/base/sut/generic/behaviours/find.rb +4 -4
  15. data/lib/tdriver/base/sut/generic/behaviours/flash_behaviour.rb +3 -3
  16. data/lib/tdriver/base/sut/generic/behaviours/sut.rb +350 -165
  17. data/lib/tdriver/base/sut/generic/behaviours/switchbox_behaviour.rb +9 -9
  18. data/lib/tdriver/base/sut/generic/behaviours/verification.rb +191 -103
  19. data/lib/tdriver/base/sut/generic/commands/application.rb +1 -1
  20. data/lib/tdriver/base/sut/generic/commands/key_sequence.rb +1 -1
  21. data/lib/tdriver/base/sut/generic/commands/screen_capture.rb +1 -1
  22. data/lib/tdriver/base/sut/generic/plugin.rb +1 -1
  23. data/lib/tdriver/base/sut/sut.rb +5 -1
  24. data/lib/tdriver/base/test_object/abstract.rb +136 -151
  25. data/lib/tdriver/base/test_object/adapter.rb +293 -82
  26. data/lib/tdriver/base/test_object/behaviours/syncronization.rb +20 -17
  27. data/lib/tdriver/base/test_object/behaviours/test_object.rb +159 -532
  28. data/lib/tdriver/base/test_object/cache.rb +1 -1
  29. data/lib/tdriver/base/test_object/factory.rb +254 -605
  30. data/lib/tdriver/base/test_object/identificator.rb +1 -1
  31. data/lib/tdriver/base/test_object/loader.rb +1 -1
  32. data/lib/tdriver/base/test_object/verification.rb +17 -17
  33. data/lib/tdriver/loader.rb +20 -9
  34. data/lib/tdriver/report/report.rb +5 -0
  35. data/lib/tdriver/report/report_creator.rb +2 -2
  36. data/lib/tdriver/report/report_cucumber_listener.rb +4 -4
  37. data/lib/tdriver/report/report_cucumber_reporter.rb +4 -4
  38. data/lib/tdriver/report/report_execution_statistics.rb +22 -22
  39. data/lib/tdriver/report/report_grouping.rb +2 -2
  40. data/lib/tdriver/report/report_javascript.rb +11 -4
  41. data/lib/tdriver/report/report_test_case_run.rb +2 -2
  42. data/lib/tdriver/report/report_test_run.rb +5 -5
  43. data/lib/tdriver/report/report_test_unit.rb +74 -26
  44. data/lib/tdriver/report/report_writer.rb +70 -13
  45. data/lib/tdriver/tdriver.rb +17 -8
  46. data/lib/tdriver/util/common/array.rb +1 -1
  47. data/lib/tdriver/util/common/crc16.rb +1 -1
  48. data/lib/tdriver/util/common/environment.rb +1 -1
  49. data/lib/tdriver/util/common/file.rb +18 -9
  50. data/lib/tdriver/util/common/gem.rb +1 -1
  51. data/lib/tdriver/util/common/hash.rb +21 -0
  52. data/lib/tdriver/util/common/kernel.rb +1 -1
  53. data/lib/tdriver/util/common/loader.rb +5 -2
  54. data/lib/tdriver/util/common/numeric.rb +54 -3
  55. data/lib/tdriver/util/common/retryable.rb +30 -12
  56. data/lib/tdriver/util/common/stackable.rb +185 -0
  57. data/lib/tdriver/util/common/string.rb +21 -5
  58. data/lib/tdriver/util/{dbaccess/dbaccess.rb → database/access.rb} +4 -1
  59. data/lib/tdriver/util/{dbaccess/dbconnection.rb → database/connection.rb} +3 -0
  60. data/lib/tdriver/util/{dbaccess → database}/error.rb +0 -1
  61. data/lib/tdriver/util/{dbaccess → database}/loader.rb +5 -6
  62. data/lib/tdriver/util/{dynamic_attribute_filter.rb → filters/dynamic_attributes.rb} +1 -1
  63. data/lib/tdriver/util/hooking/hooking.rb +477 -0
  64. data/lib/tdriver/util/loader.rb +35 -29
  65. data/lib/tdriver/util/localisation/error.rb +0 -1
  66. data/lib/tdriver/util/localisation/loader.rb +1 -4
  67. data/lib/tdriver/util/localisation/localisation.rb +30 -27
  68. data/lib/tdriver/util/{common.rb → logger/loader.rb} +2 -4
  69. data/lib/tdriver/util/logger/logger.rb +574 -0
  70. data/lib/tdriver/util/operator_data/loader.rb +4 -3
  71. data/lib/tdriver/util/operator_data/operator_data.rb +5 -5
  72. data/lib/tdriver/util/parameter/parameter.rb +7 -1
  73. data/lib/tdriver/util/parameter/parameter_hash.rb +1 -1
  74. data/lib/tdriver/util/parameter/parameter_template.rb +1 -1
  75. data/lib/tdriver/util/parameter/parameter_user_api.rb +28 -20
  76. data/lib/tdriver/util/parameter/parameter_xml.rb +1 -1
  77. data/lib/tdriver/util/plugin/abstract.rb +1 -1
  78. data/lib/tdriver/util/plugin/service.rb +1 -1
  79. data/lib/tdriver/util/{localisation.rb → recorder/loader.rb} +4 -3
  80. data/lib/tdriver/util/recorder/recorder.rb +66 -0
  81. data/lib/tdriver/util/recorder/scripter.rb +258 -0
  82. data/lib/tdriver/util/{stats.rb → statistics/statistics.rb} +7 -8
  83. data/lib/tdriver/util/user_data/error.rb +0 -1
  84. data/lib/tdriver/util/user_data/loader.rb +1 -2
  85. data/lib/tdriver/util/user_data/user_data.rb +6 -6
  86. data/lib/tdriver/util/video/camera.rb +67 -0
  87. data/lib/tdriver/util/video/camera_linux.rb +139 -0
  88. data/lib/tdriver/util/video/camera_windows.rb +174 -0
  89. data/lib/tdriver/util/video/loader.rb +31 -0
  90. data/lib/tdriver/util/video/video_utils.rb +139 -0
  91. data/lib/tdriver/util/xml/abstraction.rb +56 -5
  92. data/lib/tdriver/util/xml/builder.rb +2 -5
  93. data/lib/tdriver/util/{parameter.rb → xml/comment.rb} +10 -2
  94. data/lib/tdriver/util/xml/loader.rb +32 -22
  95. data/lib/tdriver/util/xml/nil_node.rb +2 -2
  96. data/lib/tdriver/util/xml/parsers/loader.rb +0 -1
  97. data/lib/tdriver/util/xml/parsers/nokogiri/abstraction.rb +18 -44
  98. data/lib/tdriver/util/xml/parsers/nokogiri/attribute.rb +9 -13
  99. data/lib/tdriver/util/xml/parsers/nokogiri/builder.rb +9 -3
  100. data/lib/tdriver/util/xml/parsers/nokogiri/comment.rb +39 -0
  101. data/lib/tdriver/util/xml/parsers/nokogiri/document.rb +6 -11
  102. data/lib/tdriver/util/xml/parsers/nokogiri/element.rb +2 -122
  103. data/lib/tdriver/util/xml/parsers/nokogiri/loader.rb +26 -16
  104. data/lib/tdriver/util/xml/parsers/nokogiri/node.rb +203 -0
  105. data/lib/tdriver/util/xml/parsers/nokogiri/nodeset.rb +1 -2
  106. data/lib/tdriver/util/xml/parsers/nokogiri/text.rb +2 -20
  107. data/lib/tdriver/util/xml/xml.rb +52 -20
  108. data/lib/tdriver/verify/verify.rb +238 -81
  109. data/xml/behaviours/generic.xml +12 -10
  110. metadata +156 -180
  111. data/lib/tdriver/base/test_object/factory_new.rb +0 -202
  112. data/lib/tdriver/util/hooking.rb +0 -434
  113. data/lib/tdriver/util/logger.rb +0 -506
  114. data/lib/tdriver/util/recorder.rb +0 -297
  115. data/lib/tdriver/util/video_utils.rb +0 -384
  116. data/lib/tdriver/util/xml/nil_element.rb +0 -89
@@ -17,13 +17,6 @@
17
17
  ##
18
18
  ############################################################################
19
19
 
20
-
21
- require 'rubygems'
22
- require 'net/http'
23
- require 'socket'
24
- require 'uri'
25
- require 'date'
26
-
27
20
  # Utility for storing statistics regarding TDriver usage
28
21
  #
29
22
  #
@@ -50,6 +43,12 @@ module MobyUtil
50
43
 
51
44
  return nil if defined?( $_TDRIVER_DISABLE_STATS_REPORTING )
52
45
 
46
+ require 'rubygems'
47
+ require 'uri'
48
+ require 'socket'
49
+ require 'net/http'
50
+ require 'date'
51
+
53
52
  report_thread = Thread.new{
54
53
 
55
54
  begin
@@ -83,7 +82,7 @@ module MobyUtil
83
82
 
84
83
  end
85
84
 
86
- MobyUtil::Hooking.instance.hook_methods( self ) if defined?( MobyUtil::Hooking )
85
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
87
86
 
88
87
  end # Stats
89
88
 
@@ -17,7 +17,6 @@
17
17
  ##
18
18
  ############################################################################
19
19
 
20
-
21
20
  module MobyUtil
22
21
 
23
22
  # This error should be raised when the desired user data is not found
@@ -17,10 +17,9 @@
17
17
  ##
18
18
  ############################################################################
19
19
 
20
-
21
20
  # user data inputs related errors
22
21
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'error.rb' ) )
23
22
 
24
- # user data inputs module implementation
23
+ # user data inputs module implementation
25
24
  require File.expand_path( File.join( File.dirname( __FILE__ ), 'user_data.rb' ) )
26
25
 
@@ -64,12 +64,12 @@ module MobyUtil
64
64
  Kernel::raise UserDataNotFoundError.new( "User data logical name can't be empty" ) if user_data_lname == nil
65
65
 
66
66
  # Get Localization parameters for DB Connection
67
- db_type = MobyUtil::Parameter[ :user_data_db_type, nil ].to_s.downcase
68
- host = MobyUtil::Parameter[ :user_data_server_ip ]
69
- username = MobyUtil::Parameter[ :user_data_server_username ]
70
- password = MobyUtil::Parameter[ :user_data_server_password ]
71
- database_name = MobyUtil::Parameter[ :user_data_server_database_name ]
72
- table_name = MobyUtil::Parameter[:user_data_server_database_tablename] if table_name.nil? or table_name.empty?
67
+ db_type = $parameters[ :user_data_db_type, nil ].to_s.downcase
68
+ host = $parameters[ :user_data_server_ip ]
69
+ username = $parameters[ :user_data_server_username ]
70
+ password = $parameters[ :user_data_server_password ]
71
+ database_name = $parameters[ :user_data_server_database_name ]
72
+ table_name = $parameters[:user_data_server_database_tablename] if table_name.nil? or table_name.empty?
73
73
 
74
74
  db_connection = DBConnection.new( db_type, host, database_name, username, password )
75
75
 
@@ -0,0 +1,67 @@
1
+ ############################################################################
2
+ ##
3
+ ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ## All rights reserved.
5
+ ## Contact: Nokia Corporation (testabilitydriver@nokia.com)
6
+ ##
7
+ ## This file is part of Testability Driver.
8
+ ##
9
+ ## If you have questions regarding the use of this file, please contact
10
+ ## Nokia at testabilitydriver@nokia.com .
11
+ ##
12
+ ## This library is free software; you can redistribute it and/or
13
+ ## modify it under the terms of the GNU Lesser General Public
14
+ ## License version 2.1 as published by the Free Software Foundation
15
+ ## and appearing in the file LICENSE.LGPL included in the packaging
16
+ ## of this file.
17
+ ##
18
+ ############################################################################
19
+
20
+ module MobyUtil
21
+
22
+ # Base class and interface for camera recorders in TDriver
23
+ class TDriverCam
24
+
25
+ # Automatically select the right kind of camera implementation for the detected platform.
26
+ def self.new_cam( *args )
27
+
28
+ if EnvironmentHelper.windows?
29
+
30
+ MobyUtil::TDriverWinCam.new( *args )
31
+
32
+ elsif EnvironmentHelper.linux?
33
+
34
+ MobyUtil::TDriverLinuxCam.new( *args )
35
+
36
+ else
37
+
38
+ raise RuntimeError.new("Unidentified platform type, unable to select platform specific camera. Supported platform types: Linux, Windows.")
39
+
40
+ end
41
+
42
+ end
43
+
44
+ def initialize
45
+
46
+ raise RuntimeError.new("TDriverCam abstract class")
47
+
48
+ end
49
+
50
+ def start_recording
51
+
52
+ raise RuntimeError.new("TDriverCam abstract class")
53
+
54
+ end
55
+
56
+ def stop_recording
57
+
58
+ raise RuntimeError.new("TDriverCam abstract class")
59
+
60
+ end
61
+
62
+ # enable hooking for performance measurement & debug logging
63
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
64
+
65
+ end # TDriverCam
66
+
67
+ end # MobyUtil
@@ -0,0 +1,139 @@
1
+ ############################################################################
2
+ ##
3
+ ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ## All rights reserved.
5
+ ## Contact: Nokia Corporation (testabilitydriver@nokia.com)
6
+ ##
7
+ ## This file is part of Testability Driver.
8
+ ##
9
+ ## If you have questions regarding the use of this file, please contact
10
+ ## Nokia at testabilitydriver@nokia.com .
11
+ ##
12
+ ## This library is free software; you can redistribute it and/or
13
+ ## modify it under the terms of the GNU Lesser General Public
14
+ ## License version 2.1 as published by the Free Software Foundation
15
+ ## and appearing in the file LICENSE.LGPL included in the packaging
16
+ ## of this file.
17
+ ##
18
+ ############################################################################
19
+
20
+ module MobyUtil
21
+
22
+ # Linux streamer webcam implementation
23
+ # Requires that the streamer application is installed
24
+ class TDriverLinuxCam
25
+
26
+ STARTUP_TIMEOUT = 60
27
+
28
+ DEFAULT_OPTIONS = { :device => '/dev/video0', :width => 320, :height => 240, :fps => 5 }
29
+
30
+ # TODO: document me
31
+ def self.new_cam( *args )
32
+
33
+ MobyUtil::TDriverLinuxCam.new( *args )
34
+
35
+ end
36
+
37
+ # Creates a new recroding object witdh the given recording options
38
+ # === params
39
+ # video_file: String, path and name of file where the recorded video is stored
40
+ # user_options: (optional) Hash, keys :fps, :width, :height can be used to overwrite defaults
41
+ def initialize( video_file, user_options = {} )
42
+
43
+ @_device = nil
44
+ @_video_file = nil
45
+ @_recording = false
46
+ @_rec_options = nil
47
+ @_owcc_startex = nil
48
+ @_owcc_stop = nil
49
+
50
+ @_control_id = nil
51
+ @_video_file = video_file
52
+ @_rec_options = DEFAULT_OPTIONS.merge user_options
53
+
54
+ end
55
+
56
+ # Starts recording based on options given during initialization
57
+ # === raises
58
+ # RuntimeError: No filename has been defined or recording initialization failed due to timeout.
59
+ def start_recording
60
+
61
+ raise RuntimeError.new( "No video file defined, unable to start recording." ) if @_video_file.nil?
62
+
63
+ if File.exists?( @_video_file )
64
+ begin
65
+ File.delete( @_video_file )
66
+ rescue
67
+ # no reaction to failed file ops, unless recording fails
68
+ end
69
+ end
70
+
71
+ rec_command = 'streamer -q -c ' + @_rec_options[ :device ].to_s + ' -f rgb24 -r ' + @_rec_options[ :fps ].to_s + ' -t 99:00:00 -o ' + @_video_file.to_s + ' -s ' + @_rec_options[ :width ].to_s + 'x' + @_rec_options[ :height ].to_s
72
+
73
+ @_streamer_pid = fork do
74
+ begin
75
+ Kernel::exec( rec_command )
76
+ rescue Exception => e
77
+ raise RuntimeError.new( "An error was encountered while launching streamer:\n" << e.inspect )
78
+ end
79
+ end
80
+
81
+ file_timed_out = false
82
+
83
+ file_timeout = Time.now + STARTUP_TIMEOUT
84
+
85
+ while File.size?( @_video_file ).nil? && !file_timed_out do
86
+
87
+ #wait for recording to start, ie. filesize > 0
88
+ sleep 0.1
89
+
90
+ file_timed_out = true if Time.now > file_timeout
91
+
92
+ end
93
+
94
+ if file_timed_out
95
+
96
+ # make sure recording is not initializing, clean up any failed file
97
+ begin
98
+ Process.kill( 9, @_streamer_pid.to_i )
99
+ rescue
100
+ end
101
+
102
+ if File.exists?( @_video_file )
103
+ begin
104
+ File.delete( @_video_file )
105
+ rescue
106
+ end
107
+ end
108
+
109
+ raise RuntimeError.new( "Failed to start recording. Timeout: #{STARTUP_TIMEOUT} second(s). File: \"#{@_video_file}\" " )
110
+
111
+ end
112
+
113
+ @_recording = true
114
+
115
+ nil
116
+
117
+ end
118
+
119
+ # Stops ongoing recording
120
+ def stop_recording
121
+
122
+ if @_recording
123
+
124
+ @_recording = false
125
+
126
+ Process.kill( 9, @_streamer_pid.to_i )
127
+
128
+ end
129
+
130
+ nil
131
+
132
+ end
133
+
134
+ # enable hooking for performance measurement & debug logging
135
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
136
+
137
+ end #TDriverLinuxCam
138
+
139
+ end # MobyUtil
@@ -0,0 +1,174 @@
1
+ ############################################################################
2
+ ##
3
+ ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4
+ ## All rights reserved.
5
+ ## Contact: Nokia Corporation (testabilitydriver@nokia.com)
6
+ ##
7
+ ## This file is part of Testability Driver.
8
+ ##
9
+ ## If you have questions regarding the use of this file, please contact
10
+ ## Nokia at testabilitydriver@nokia.com .
11
+ ##
12
+ ## This library is free software; you can redistribute it and/or
13
+ ## modify it under the terms of the GNU Lesser General Public
14
+ ## License version 2.1 as published by the Free Software Foundation
15
+ ## and appearing in the file LICENSE.LGPL included in the packaging
16
+ ## of this file.
17
+ ##
18
+ ############################################################################
19
+
20
+ module MobyUtil
21
+
22
+ # Windows DirectShow webcam implementation
23
+ class TDriverWinCam
24
+
25
+ STARTUP_TIMEOUT = 60
26
+
27
+ DEFAULT_OPTIONS = { :device => nil, :width => 640, :height => 480, :fps => 30 }
28
+
29
+ # TODO: document me
30
+ def self.new_cam( *args )
31
+
32
+ MobyUtil::TDriverWinCam.new( *args )
33
+
34
+ end
35
+
36
+ # Creates a new recroding object witdh the given recording options
37
+ # === params
38
+ # video_file: String, path and name of file where the recorded video is stored
39
+ # user_options: (optional) Hash, keys :fps, :width, :height can be used to overwrite defaults
40
+ def initialize( video_file, user_options = {} )
41
+
42
+ @_device = nil
43
+ @_video_file = nil
44
+ @_recording = false
45
+ @_rec_options = nil
46
+ @_owcc_startex = nil
47
+ @_owcc_stop = nil
48
+
49
+ require 'Win32API'
50
+
51
+ begin
52
+
53
+ @_owcc_startex = Win32API.new( 'TDriverWebCamControl', 'OscarWebCamControlStartEx', [ 'P', 'N', 'N', 'N', 'L', 'L', 'L', 'I', 'I' ], 'L' )
54
+ @_owcc_stop = Win32API.new( 'TDriverWebCamControl', 'OscarWebCamControlStop', [ 'L' ], 'V' )
55
+
56
+ rescue Exception => e
57
+
58
+ begin
59
+
60
+ #OSCARWEBCAMCONTROL_API long OscarWebCamControlStartEx(char* captureFile, double compQuality, DWORD dwBitsPerSec, long lFramesPerSec, long lCapWidth, long lCapHeight, bool bFlipV, bool bFlipH)
61
+ @_owcc_startex = Win32API.new( 'OscarWebCamControl', 'OscarWebCamControlStartEx', [ 'P', 'N', 'N', 'N', 'L', 'L', 'L', 'I', 'I' ], 'L' )
62
+ #OSCARWEBCAMCONTROL_API void OscarWebCamControlStop(long pTargetMediaControl)
63
+ @_owcc_stop = Win32API.new( 'OscarWebCamControl', 'OscarWebCamControlStop', [ 'L' ], 'V' )
64
+
65
+ rescue Exception => ee
66
+ raise RuntimeError.new( "Failed to connect to video recording DLL file (TDriverWebCamControl.dll or OscarWebCamControl.dll). Details:\n" + ee.message )
67
+ end
68
+
69
+ end
70
+
71
+ if user_options.has_key? :device
72
+
73
+ puts "WARNING: TDriverWinCam does not support the :device option. This setting is ignored."
74
+
75
+ end
76
+
77
+ @_control_id = nil
78
+ @_video_file = video_file
79
+ @_rec_options = DEFAULT_OPTIONS.merge user_options
80
+
81
+ end
82
+
83
+ # Starts recording based on options given during initialization
84
+ # === raises
85
+ # RuntimeError: No filename has been defined or recording initialization failed due to timeout.
86
+ def start_recording
87
+
88
+ raise RuntimeError.new("No video file defined, unable to start recording.") if @_video_file.nil?
89
+
90
+ if File.exists?( @_video_file )
91
+ begin
92
+ File.delete( @_video_file )
93
+ rescue
94
+ # no reaction to failed file ops, unless recording fails
95
+ end
96
+ end
97
+
98
+ @_control_id = @_owcc_startex.call( @_video_file, 0, 0, 0, @_rec_options[ :fps ].to_i, @_rec_options[ :width ].to_i, @_rec_options[ :height ].to_i, 0, 0 )
99
+
100
+ if @_control_id == 0
101
+
102
+ Kernel::raise RuntimeError.new( "Failed to start video recording.\nFile: " + @_video_file + "\nFPS: " + @_rec_options[ :fps ].to_s + "\nWidth: " + @_rec_options[ :width ].to_s + "\nHeight: " + @_rec_options[ :height ].to_s )
103
+
104
+ end
105
+
106
+ file_timed_out = false
107
+
108
+ file_timeout = Time.now + STARTUP_TIMEOUT
109
+
110
+ while File.size?( @_video_file ).nil? && !file_timed_out do
111
+
112
+ #wait for recording to start, ie. filesize > 0
113
+ sleep 1
114
+
115
+ # force refresh file size
116
+ begin
117
+
118
+ if File.exists?( @_video_file )
119
+ File.open( @_video_file, 'r' ) do
120
+ end
121
+ end
122
+
123
+ rescue
124
+
125
+ end
126
+
127
+ if Time.now > file_timeout
128
+ file_timed_out = true
129
+ end
130
+
131
+ end
132
+
133
+ if file_timed_out
134
+
135
+ # make sure recording is not initializing, clean up any failed file
136
+ begin
137
+ @_owcc_stop.call( @_control_id )
138
+ rescue
139
+ end
140
+
141
+ if File.exists?( @_video_file )
142
+ begin
143
+ File.delete( @_video_file )
144
+ rescue
145
+ end
146
+ end
147
+
148
+ raise RuntimeError.new( "Failed to start recording. Timeout: #{STARTUP_TIMEOUT} File: \"#{@_video_file}\" " )
149
+ end
150
+
151
+ @_recording = true
152
+
153
+ nil
154
+
155
+ end
156
+
157
+ # Stops ongoing recording
158
+ def stop_recording
159
+
160
+ if @_recording
161
+ @_recording = false
162
+ @_owcc_stop.call( @_control_id )
163
+ end
164
+
165
+ nil
166
+
167
+ end
168
+
169
+ # enable hooking for performance measurement & debug logging
170
+ TDriver::Hooking.hook_methods( self ) if defined?( TDriver::Hooking )
171
+
172
+ end #TDriverWinCam
173
+
174
+ end # MobyUtil