class CheckActMonitor
Public Instance Methods
test_act_monitor()
click to toggle source
colinux:9190/HelloQwik/ActMonitor.html
# File vendor/qwik/lib/qwik/check-act-monitor.rb, line 34 def test_act_monitor return if $0 != __FILE__ # Only for unit test. server = setup_monitor str = get_path('1.html') ok_in(['t'], '//title', str) ok_in([:p, 'p'], "//div[@class='section']", str) t = Thread.new { sleep 0.1 str = get_path("1.save?contents=*t2%0Ap2") # Save to the page. ok_in(['Page is saved.'], '//title', str) ok_eq("*t2\np2", read_page('1')) } str = get_path('1.monitor') # Wait for update. ok_in([:p, 'p2'], "//div[@class='section']", str) t.join # Wait for the thread. teardown_server(server) end
test_monitor_in_thread()
click to toggle source
# File vendor/qwik/lib/qwik/check-act-monitor.rb, line 58 def test_monitor_in_thread return if $0 != __FILE__ # Only for unit test. server = setup_monitor str = get_path('1.html') ok_in(['t'], '//title', str) ok_in([:p, 'p'], "//div[@class='section']", str) t = Thread.new { str = get_path('1.monitor') # Wait for update. ok_in([:p, 'p2'], "//div[@class='section']", str) } sleep 0.1 str = get_path("1.save?contents=*t2%0Ap2") # Save to the page. ok_in(['Page is saved.'], '//title', str) ok_eq("*t2\np2", read_page('1')) t.join # Wait for the thread. teardown_server(server) end
test_several_monitors()
click to toggle source
# File vendor/qwik/lib/qwik/check-act-monitor.rb, line 82 def test_several_monitors return if $0 != __FILE__ # Only for unit test. server = setup_monitor str = get_path('1.html') ok_in(['t'], '//title', str) ok_in([:p, 'p'], "//div[@class='section']", str) t1 = Thread.new { str1 = get_path('1.monitor') # Wait for update. ok_in([:p, 'p2'], "//div[@class='section']", str1) } t2 = Thread.new { str2 = get_path('1.monitor') # Wait for update. ok_in([:p, 'p2'], "//div[@class='section']", str2) } sleep 0.1 str = get_path("1.save?contents=*t2%0Ap2") # Save to the page. ok_in(['Page is saved.'], '//title', str) ok_eq("*t2\np2", read_page('1')) t1.join # Wait for the thread. t2.join # Wait for the thread. teardown_server(server) end