webkit_remote 0.5.2 → 0.5.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 416d67a2b6d35035f958ba12d78f6df811c8d3da
4
- data.tar.gz: e84f8431c006987ed00bc6820d735ebd32007b33
3
+ metadata.gz: fb3ccfba70d3f677946e7aea83a46d515858b56a
4
+ data.tar.gz: c35c1614ca83eecbd4ab0259227221aec466bee5
5
5
  SHA512:
6
- metadata.gz: ab633fc32026f9550a550ecfc24630a6256cd17b6253020dac5428f3810ab008dc2d982e2014d6ce75f57c50e6f75b164cc7fd74746ce0fc3236c5826261682a
7
- data.tar.gz: 175f76e8c8fe401d7f3dd0285eb1019cb5a36da172dbb8d2c1646c940adcbfc1c80117bdbe6c618fd447c187d95670597326619bb45bf60d610739ce4ceb2855
6
+ metadata.gz: 1cfc3b83187a5d4d6d36ee3fb5113471027ef8f522f7a7434f685315774fd8353edeadba6285c0575a1d4602af7ba3e244a1c94ac392722f5b022f8d5c8f7d09
7
+ data.tar.gz: 14960e8733fec9ebba3563c620800b93415d5fa18a96b5b6919b6f4d58eb39c014227c62908cb26d31e7cb72564943b7428d9ddeb510f4fa467e62adc97a9062
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.2
1
+ 0.5.3
@@ -21,6 +21,9 @@ class Process
21
21
  # real screen; set the :display, :width, :height, :depth and :dpi of the
22
22
  # server, or use the default display number 20, at 1280x1024x32 with
23
23
  # 72dpi
24
+ # @option opts [Boolean] allow_popups when true, the popup blocker is
25
+ # disabled; this is sometimes necessary when driving a Web UI via
26
+ # JavaScript
24
27
  def initialize(opts = {})
25
28
  @port = opts[:port] || 9292
26
29
  @timeout = opts[:timeout] || 10
@@ -148,6 +151,28 @@ class Process
148
151
  [
149
152
  chrome_env(opts),
150
153
  self.class.chrome_binary,
154
+ ] + chrome_cli_flags(opts) + [
155
+ "--remote-debugging-port=#{@port}", # Webkit remote debugging
156
+ "--user-data-dir=#{@data_dir}", # really ensure a clean slate
157
+ "--window-position=#{@window[:left]},#{@window[:top]}",
158
+ "--window-size=#{@window[:width]},#{@window[:height]}",
159
+
160
+ 'about:blank', # don't load the homepage
161
+ {
162
+ chdir: @data_dir,
163
+ in: '/dev/null',
164
+ out: File.join(@data_dir, '.stdout'),
165
+ err: File.join(@data_dir, '.stderr')
166
+ },
167
+ ]
168
+ end
169
+
170
+ # Flags used on the command-line that launches Google Chrome / Chromium.
171
+ #
172
+ # @param [Hash] opts options passed to the WebkitRemote::Process constructor
173
+ # @return [Array<String>] flags used on the command line for launching Chrome
174
+ def chrome_cli_flags(opts)
175
+ flags = [
151
176
  '--bwsi', # disable extensions, sync, bookmarks
152
177
  '--disable-default-apps', # no bundled apps
153
178
  '--disable-extensions', # no extensions
@@ -170,19 +195,9 @@ class Process
170
195
  '--no-message-box', # don't let user scripts show dialogs
171
196
  '--no-service-autorun', # don't mess with autorun settings
172
197
  '--noerrdialogs', # don't hang on error dialogs
173
- "--remote-debugging-port=#{@port}", # Webkit remote debugging
174
- "--user-data-dir=#{@data_dir}", # really ensure a clean slate
175
- "--window-position=#{@window[:left]},#{@window[:top]}", # randomness--
176
- "--window-size=#{@window[:width]},#{@window[:height]}", # randomness--
177
-
178
- 'about:blank', # don't load the homepage
179
- {
180
- chdir: @data_dir,
181
- in: '/dev/null',
182
- out: File.join(@data_dir, '.stdout'),
183
- err: File.join(@data_dir, '.stderr')
184
- },
185
198
  ]
199
+ flags << '--disable-popup-blocking' if opts[:allow_popups]
200
+ flags
186
201
  end
187
202
 
188
203
  # Environment variables set when launching Chrome.
@@ -1,4 +1,4 @@
1
- <!doctype html>
1
+ <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
4
  <title>WebkitRemote Console test</title>
@@ -1,4 +1,4 @@
1
- <!doctype html>
1
+ <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
4
  <title>WebkitRemote DOM test</title>
@@ -20,4 +20,3 @@
20
20
  </article>
21
21
  </body>
22
22
  </html>
23
-
@@ -1,4 +1,4 @@
1
- <!doctype html>
1
+ <!DOCTYPE html>
2
2
  <html>
3
3
  <head><title>WebkitRemote load test</title></head>
4
4
  <body>
@@ -1,4 +1,4 @@
1
- <!doctype html>
1
+ <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
4
  <title>WebkitRemote Network test</title>
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Popup window for WebkitRemote Process allow_popups test</title>
5
+ <script type="text/javascript">
6
+ window.opener.postMessage('popup says hi', '*');
7
+ </script>
8
+ </head>
9
+ <body>
10
+ <p>Popup for Process allow_popups test loaded.</p>
11
+ </body>
12
+ </html>
13
+
14
+
@@ -0,0 +1,20 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>WebkitRemote Process allow_popups test</title>
5
+ <script type="text/javascript">
6
+ (function() {
7
+ window.addEventListener('message', function (event) {
8
+ if (event.data === 'popup says hi') {
9
+ console.log('Received popup message.');
10
+ }
11
+ });
12
+ window.open('popup.html');
13
+ })();
14
+ </script>
15
+ </head>
16
+ <body>
17
+ <p>Process allow_popups test loaded</p>
18
+ </body>
19
+ </html>
20
+
@@ -1,4 +1,4 @@
1
- <!doctype html>
1
+ <!DOCTYPE html>
2
2
  <html>
3
3
  <head>
4
4
  <title>WebkitRemote Runtime test</title>
data/test/helper.rb CHANGED
@@ -50,7 +50,6 @@ class MiniTest::Test
50
50
  include RunPumaInMinitest
51
51
  end
52
52
 
53
- #class MiniTest::Test
54
53
  class MiniTest::Test
55
54
  # URL for a file in the test/fixtures directory.
56
55
  def fixture_url(name, type = :html)
@@ -0,0 +1,24 @@
1
+ require File.expand_path('../helper.rb', File.dirname(__FILE__))
2
+
3
+ # This tests the command-line flags code by making sure that Chrome works in
4
+ # the intended fashion. By the nature of the test, it looks more like an
5
+ # integration test than the unit-level Process tests in process_test.rb.
6
+
7
+ describe WebkitRemote::Process do
8
+ after :all do
9
+ @client.close if @client
10
+ end
11
+
12
+ describe 'with allow_popups: true' do
13
+ before :all do
14
+ @client = WebkitRemote.local port: 9669, allow_popups: true
15
+ @client.console_events = true
16
+ end
17
+
18
+ it 'runs through a page that uses window.open without a gesture' do
19
+ @client.navigate_to fixture_url(:popup_user)
20
+ events = @client.wait_for type: WebkitRemote::Event::ConsoleMessage
21
+ events.last.message.text.must_equal 'Received popup message.'
22
+ end
23
+ end
24
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "webkit_remote"
8
- s.version = "0.5.2"
8
+ s.version = "0.5.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Victor Costan"]
12
- s.date = "2014-03-18"
12
+ s.date = "2014-03-19"
13
13
  s.description = "Launches Google Chrome instances and controls them via the Remote Debugging server"
14
14
  s.email = "victor@costan.us"
15
15
  s.extra_rdoc_files = [
@@ -47,6 +47,8 @@ Gem::Specification.new do |s|
47
47
  "test/fixtures/html/dom.html",
48
48
  "test/fixtures/html/load.html",
49
49
  "test/fixtures/html/network.html",
50
+ "test/fixtures/html/popup.html",
51
+ "test/fixtures/html/popup_user.html",
50
52
  "test/fixtures/html/runtime.html",
51
53
  "test/fixtures/js/network.js",
52
54
  "test/fixtures/png/network.png",
@@ -61,6 +63,7 @@ Gem::Specification.new do |s|
61
63
  "test/webkit_remote/client/runtime_test.rb",
62
64
  "test/webkit_remote/client_test.rb",
63
65
  "test/webkit_remote/event_test.rb",
66
+ "test/webkit_remote/process_flags_test.rb",
64
67
  "test/webkit_remote/process_test.rb",
65
68
  "test/webkit_remote/rpc_test.rb",
66
69
  "test/webkit_remote_test.rb",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webkit_remote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Costan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-18 00:00:00.000000000 Z
11
+ date: 2014-03-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ws_sync_client
@@ -217,6 +217,8 @@ files:
217
217
  - test/fixtures/html/dom.html
218
218
  - test/fixtures/html/load.html
219
219
  - test/fixtures/html/network.html
220
+ - test/fixtures/html/popup.html
221
+ - test/fixtures/html/popup_user.html
220
222
  - test/fixtures/html/runtime.html
221
223
  - test/fixtures/js/network.js
222
224
  - test/fixtures/png/network.png
@@ -231,6 +233,7 @@ files:
231
233
  - test/webkit_remote/client/runtime_test.rb
232
234
  - test/webkit_remote/client_test.rb
233
235
  - test/webkit_remote/event_test.rb
236
+ - test/webkit_remote/process_flags_test.rb
234
237
  - test/webkit_remote/process_test.rb
235
238
  - test/webkit_remote/rpc_test.rb
236
239
  - test/webkit_remote_test.rb