From e54bec3feb08b09de64945f72885c8c37258de60 Mon Sep 17 00:00:00 2001 From: Philip Chimento Date: Wed, 12 Apr 2017 15:24:48 -0700 Subject: build: Remove Webhelper Webhelper is now in its own repository: https://github.com/endlessm/webhelper https://phabricator.endlessm.com/T16203 --- test/smoke-tests/webhelper/webview.js | 160 --------------------------------- test/smoke-tests/webhelper/webview2.js | 147 ------------------------------ 2 files changed, 307 deletions(-) delete mode 100644 test/smoke-tests/webhelper/webview.js delete mode 100644 test/smoke-tests/webhelper/webview2.js (limited to 'test/smoke-tests') diff --git a/test/smoke-tests/webhelper/webview.js b/test/smoke-tests/webhelper/webview.js deleted file mode 100644 index a1dba65..0000000 --- a/test/smoke-tests/webhelper/webview.js +++ /dev/null @@ -1,160 +0,0 @@ -//Copyright 2013 Endless Mobile, Inc. - -const Endless = imports.gi.Endless; -const GLib = imports.gi.GLib; -const Gtk = imports.gi.Gtk; -const Lang = imports.lang; -const WebHelper = imports.webhelper; -const WebKit = imports.gi.WebKit; - -const TEST_APPLICATION_ID = 'com.endlessm.example.test-webview'; - -const TEST_HTML = '\ - \ - \ -First page \ - \ - \ -\ - \ -

First page

\ -\ -

Move to page 2

\ -\ -

Show \ -message from parameter in this URL

\ -\ -
\ - \ - \ -
\ -\ -

\ - \ -Show message \ -using the <input>\'s ID \ -

\ -\ -

Regular link to a Web site

\ -\ -

I want \ -stars!

\ -\ -

This is text that will be italicized: Hello, \ -world!

\ -\ - \ -'; - -const TestApplication = new Lang.Class({ - Name: 'TestApplication', - Extends: WebHelper.Application, - - /* *** ACTIONS AVAILABLE FROM THE WEB VIEW *** */ - - /* dict['name'] is the name of the page to move to */ - moveToPage: function(dict) { - this._pm.visible_child_name = dict['name']; - }, - - /* dict['msg'] is the message to display */ - showMessageFromParameter: function(dict) { - let dialog = new Gtk.MessageDialog({ - buttons: Gtk.ButtonsType.CLOSE, - message_type: Gtk.MessageType.INFO, - text: dict['msg'] - }); - dialog.set_transient_for(this._window); - dialog.run(); - dialog.destroy(); - }, - - /* dict['id'] is the ID of the input field to use */ - showMessageFromInputField: function(dict) { - let input = this._getElementById(this._webview, dict['id']); - - // WebKitDOMHTMLInputElement - let msg = input.get_value(); - - let dialog = new Gtk.MessageDialog({ - buttons: Gtk.ButtonsType.CLOSE, - message_type: Gtk.MessageType.INFO, - text: msg - }); - dialog.set_transient_for(this._window); - dialog.run(); - dialog.destroy(); - }, - - /* dict['id'] is the ID of the element to use */ - addStars: function(dict) { - let e = this._getElementById(this._webview, dict['id']); - e.inner_text += '★ '; - }, - - /* *************************** */ - - vfunc_startup: function() { - this.parent(); - - this.set_translation_function(function(string) { - return string.italics(); - }); - this.define_web_actions({ - moveToPage: this.moveToPage, - showMessageFromParameter: this.showMessageFromParameter, - showMessageFromInputField: this.showMessageFromInputField, - addStars: this.addStars - }); - - this._webview = new WebKit.WebView(); - this._webview.load_string(TEST_HTML, 'text/html', 'UTF-8', 'file://'); - this._webview.connect('notify::load-status', - Lang.bind(this, function (webview) { - if (webview.load_status == WebKit.LoadStatus.FINISHED) - this.translate_html(webview); - })); - - this._webview.connect('navigation-policy-decision-requested', - Lang.bind(this, this.web_actions_handler)); - - this._page1 = new Gtk.ScrolledWindow(); - this._page1.add(this._webview); - - this._page2 = new Gtk.Grid(); - let back_button = new Gtk.Button({ label:"Go back to page 1" }); - back_button.connect('clicked', Lang.bind(this, function() { - this._pm.visible_child_name = 'page1'; - })); - this._page2.add(back_button); - - this._window = new Endless.Window({ - application: this, - border_width: 16 - }); - - this._pm = this._window.page_manager; - this._pm.set_transition_type(Gtk.StackTransitionType.CROSSFADE); - this._pm.add(this._page1, { name: 'page1' }); - this._pm.add(this._page2, { name: 'page2' }); - this._pm.visible_child = this._page1; - - this._window.show_all(); - } -}); - -let app = new TestApplication({ - application_id: TEST_APPLICATION_ID, - flags: 0 -}); -app.run(ARGV); diff --git a/test/smoke-tests/webhelper/webview2.js b/test/smoke-tests/webhelper/webview2.js deleted file mode 100644 index f50c42d..0000000 --- a/test/smoke-tests/webhelper/webview2.js +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright 2015 Endless Mobile, Inc. - -const Endless = imports.gi.Endless; -const Gettext = imports.gettext; -const Gtk = imports.gi.Gtk; -const Lang = imports.lang; -const WebHelper2 = imports.webhelper2; -const WebKit2 = imports.gi.WebKit2; - -const TEST_APPLICATION_ID = 'com.endlessm.example.test-webview2'; -const TEST_HTML = '\ - \ - \ -First page \ - \ - \ -\ - \ - \ -

First page

\ -\ -

Move to page 2

\ -\ -

Show \ -message from parameter in this URL

\ -\ -
\ - \ - \ -
\ -\ -

Regular link to a Web site

\ -\ -

This is text that will be italicized: Hello, \ -world!

\ -\ -

\ - \ - \ -

\ -\ - \ -'; - -const TestApplication = new Lang.Class({ - Name: 'TestApplication', - Extends: Endless.Application, - - vfunc_dbus_register: function (connection, object_path) { - this._webhelper = new WebHelper2.WebHelper({ - well_known_name: this.application_id, - connection: connection, - }); - return this.parent(connection, object_path); - }, - - vfunc_startup: function () { - this.parent(); - - this._webhelper.set_gettext((s) => s.italics()); - this._webhelper.set_ngettext((s, p, n) => - '** ' + (n == 1 ? s : p) + ' **'); - this._webhelper.define_web_actions({ - moveToPage: this.moveToPage.bind(this), - showMessageFromParameter: this.showMessageFromParameter.bind(this), - }); - - this._webview = new WebKit2.WebView(); - this._webview.connect('load-changed', (webview, event) => { - if (event === WebKit2.LoadEvent.FINISHED) - this._webhelper.translate_html(webview, null, (obj, res) => { - this._webhelper.translate_html_finish(res); - }); - }); - this._webview.load_html(TEST_HTML, null); - - this._page2 = new Gtk.Grid(); - let back_button = new Gtk.Button({ label: 'Go back to page 1' }); - back_button.connect('clicked', () => { - this._pm.visible_child_name = 'page1'; - }); - this._page2.add(back_button); - - this._window = new Endless.Window({ - application: this, - border_width: 16, - }); - - this._pm = this._window.page_manager; - this._pm.set_transition_type(Gtk.StackTransitionType.CROSSFADE); - this._pm.add(this._webview, { name: 'page1' }); - this._pm.add(this._page2, { name: 'page2' }); - this._pm.visible_child_name = 'page1'; - - this._window.show_all(); - }, - - vfunc_dbus_unregister: function (connection, object_path) { - this.parent(connection, object_path); - this._webhelper.unregister(); - }, - - // WEB ACTIONS - - // dict['name'] is the name of the page to move to - moveToPage: function (dict) { - this._pm.visible_child_name = dict['name']; - }, - - // dict['msg'] is the message to display - showMessageFromParameter: function (dict) { - let dialog = new Gtk.MessageDialog({ - buttons: Gtk.ButtonsType.CLOSE, - message_type: Gtk.MessageType.INFO, - text: dict['msg'], - transient_for: this._window, - }); - dialog.run(); - dialog.destroy(); - }, -}); - -let app = new TestApplication({ - application_id: TEST_APPLICATION_ID, -}); -app.run(ARGV); -- cgit v1.2.3