diff -Nru gnome-control-center-signon-0.1.6bzr13.04.05/debian/changelog gnome-control-center-signon-0.1.6bzr13.04.05daily13.05.14ubuntu.unity.next/debian/changelog --- gnome-control-center-signon-0.1.6bzr13.04.05/debian/changelog 2013-05-14 19:36:13.000000000 +0000 +++ gnome-control-center-signon-0.1.6bzr13.04.05daily13.05.14ubuntu.unity.next/debian/changelog 2013-05-14 19:36:13.000000000 +0000 @@ -1,3 +1,45 @@ +gnome-control-center-signon (0.1.6bzr13.04.05daily13.05.14ubuntu.unity.next-0ubuntu1) raring; urgency=low + + [ Ken VanDine ] + * debian/control + - Depend on libaccount-plugin-generic-oauth and libaccount-plugin-google + * Added autopilot test package + + [ Alberto Mardegan ] + * Don't report account failures. Failures should be reported by clients or + by signon-ui. + + [ Gabor Kelemen ] + * Include gi18n-lib.h to make translated strings really appear. (LP: + #1176506) + + [ David King ] + * Show the preferences panel in all desktop environments. (LP: + #1070546) + * Avoid some warnings. + + [ Alberto Mardegan ] + * OAuthPlugin: do not require mechanism or parameters They can all be + read from the .provider files. . + * Update NEWS. + * Don't crash when cancelling the authentication or disposing the + plugin This fixes a couple of crashes which would occur: 1) when + cancelling an ongoing authentication by pressing the "Cancel" + button: this is fixed by tracking the state of the asynchronous + operations and delaying the emission of the "finished" signal until + they have all completed. 2) when going back to the System Settings: + this operation would destroy the plugin, but the asynchronous + operations would still continue and the callbacks would be invoked + later on an invalid pointer to "self" (see also + https://bugzilla.gnome.org/show_bug.cgi?id=696369). This is fixed by + guarding the "self" pointer with a weak GObject pointer. (LP: + #1122520) + + [ Ubuntu daily release ] + * Automatic snapshot from revision 151 (ubuntu-unity/next) + + -- Ubuntu daily release Tue, 14 May 2013 19:18:57 +0000 + gnome-control-center-signon (0.1.6bzr13.04.05-0ubuntu1) raring; urgency=low * Don't show the credentials-preferences launcher in Unity, this keeps diff -Nru gnome-control-center-signon-0.1.6bzr13.04.05/debian/control gnome-control-center-signon-0.1.6bzr13.04.05daily13.05.14ubuntu.unity.next/debian/control --- gnome-control-center-signon-0.1.6bzr13.04.05/debian/control 2013-05-14 19:36:13.000000000 +0000 +++ gnome-control-center-signon-0.1.6bzr13.04.05daily13.05.14ubuntu.unity.next/debian/control 2013-05-14 19:36:13.000000000 +0000 @@ -18,6 +18,8 @@ libgtk-3-dev, libsignon-glib-dev (>= 1.8), pkg-config, + python, + python-distutils-extra, signond-dev, valac-0.18, xvfb, @@ -32,6 +34,8 @@ Architecture: any Depends: gnome-control-center (>= 3.4.2-0ubuntu10), libaccount-plugin-1.0-0 (= ${binary:Version}), + libaccount-plugin-generic-oauth, + libaccount-plugin-google, ${misc:Depends}, ${shlibs:Depends}, Description: GNOME Control Center extension for single signon @@ -80,3 +84,12 @@ . This package provides the developer documentation for the libaccount-plugin library. + +Package: gnome-control-center-signon-autopilot +Architecture: all +Depends: autopilot-desktop, + gnome-control-center-signon (= ${source:Version}), + uoa-integration-tests, + ${misc:Depends}, +Description: Test package for Ubuntu Online Accounts - Desktop + Autopilot tests for Ubuntu Online Accounts - Desktop diff -Nru gnome-control-center-signon-0.1.6bzr13.04.05/debian/gnome-control-center-signon-autopilot.install gnome-control-center-signon-0.1.6bzr13.04.05daily13.05.14ubuntu.unity.next/debian/gnome-control-center-signon-autopilot.install --- gnome-control-center-signon-0.1.6bzr13.04.05/debian/gnome-control-center-signon-autopilot.install 1970-01-01 00:00:00.000000000 +0000 +++ gnome-control-center-signon-0.1.6bzr13.04.05daily13.05.14ubuntu.unity.next/debian/gnome-control-center-signon-autopilot.install 2013-05-14 19:36:13.000000000 +0000 @@ -0,0 +1 @@ +usr/lib/python*/dist-packages/* diff -Nru gnome-control-center-signon-0.1.6bzr13.04.05/debian/rules gnome-control-center-signon-0.1.6bzr13.04.05daily13.05.14ubuntu.unity.next/debian/rules --- gnome-control-center-signon-0.1.6bzr13.04.05/debian/rules 2013-05-14 19:36:13.000000000 +0000 +++ gnome-control-center-signon-0.1.6bzr13.04.05daily13.05.14ubuntu.unity.next/debian/rules 2013-05-14 19:36:13.000000000 +0000 @@ -12,10 +12,12 @@ override_dh_install: rm debian/*/usr/lib/*.la rm debian/*/usr/lib/control-center-1/panels/*.la + cd tests/autopilot && \ + python setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb dh_install --fail-missing override_dh_autoreconf: NOCONFIGURE=1 dh_autoreconf ./autogen.sh %: - dh $@ --with translations,autoreconf + dh $@ --with translations,autoreconf,python2 diff -Nru gnome-control-center-signon-0.1.6bzr13.04.05/libaccount-plugin/oauth-plugin.c gnome-control-center-signon-0.1.6bzr13.04.05daily13.05.14ubuntu.unity.next/libaccount-plugin/oauth-plugin.c --- gnome-control-center-signon-0.1.6bzr13.04.05/libaccount-plugin/oauth-plugin.c 2013-03-25 13:24:55.000000000 +0000 +++ gnome-control-center-signon-0.1.6bzr13.04.05daily13.05.14ubuntu.unity.next/libaccount-plugin/oauth-plugin.c 2013-05-14 19:18:48.000000000 +0000 @@ -32,7 +32,7 @@ #include "oauth-plugin.h" -#include +#include #include #include #include diff -Nru gnome-control-center-signon-0.1.6bzr13.04.05/src/cc-credentials-authorization-page.vala gnome-control-center-signon-0.1.6bzr13.04.05daily13.05.14ubuntu.unity.next/src/cc-credentials-authorization-page.vala --- gnome-control-center-signon-0.1.6bzr13.04.05/src/cc-credentials-authorization-page.vala 2013-03-18 15:15:42.000000000 +0000 +++ gnome-control-center-signon-0.1.6bzr13.04.05daily13.05.14ubuntu.unity.next/src/cc-credentials-authorization-page.vala 2013-05-14 19:18:48.000000000 +0000 @@ -179,20 +179,6 @@ * termination with error */ if (plugin_err != null) { - try - { - var notification = new HashTable (str_hash, - null); - var display_name = new Variant.string (current_account.get_display_name ()); - notification.insert ("DisplayName", display_name); - indicator.report_failure (current_account.id, notification); - } - catch (IOError err) - { - warning ("Error reporting authentication failure: %s", - err.message); - } - critical ("Error completing auth session process: %s", plugin_err.message); } diff -Nru gnome-control-center-signon-0.1.6bzr13.04.05/tests/autopilot/gnome_control_center_signon/test_control_center_signon.py gnome-control-center-signon-0.1.6bzr13.04.05daily13.05.14ubuntu.unity.next/tests/autopilot/gnome_control_center_signon/test_control_center_signon.py --- gnome-control-center-signon-0.1.6bzr13.04.05/tests/autopilot/gnome_control_center_signon/test_control_center_signon.py 1970-01-01 00:00:00.000000000 +0000 +++ gnome-control-center-signon-0.1.6bzr13.04.05daily13.05.14ubuntu.unity.next/tests/autopilot/gnome_control_center_signon/test_control_center_signon.py 2013-05-14 19:18:48.000000000 +0000 @@ -0,0 +1,190 @@ +#! /usr/bin/env python +# -*- coding: utf-8 -*- +# +# Copyright (C) 2013 Canonical Ltd. +# Contact: Alberto Mardegan +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 3, as published +# by the Free Software Foundation. + +from autopilot.testcase import AutopilotTestCase +from autopilot.matchers import Eventually +from testtools.matchers import Contains, Equals, NotEquals, GreaterThan +from time import sleep +import BaseHTTPServer, SimpleHTTPServer, SocketServer, ssl, cgi +import threading + +class Handler(BaseHTTPServer.BaseHTTPRequestHandler): + def do_HEAD(self): + self.send_response(200) + self.send_header("Content-type", "text/html") + s.end_headers() + + def do_GET(self): + self.send_response(200) + self.send_header("Content-type", "text/html") + self.send_header('Content-Encoding', 'utf-8') + self.end_headers() + self.wfile.write(""" + + +Login here + +

Login form

+
+ Username:
+ Password:
+

+
+ + +""" % { 'port': self.server.server_port }) + self.server.show_login_event.set() + + def do_POST(self): + form = cgi.FieldStorage( + fp=self.rfile, + headers=self.headers, + environ={'REQUEST_METHOD':'POST', + 'CONTENT_TYPE':self.headers['Content-Type'], + }) + self.send_response(301) + self.send_header("Location", + "https://localhost:%(port)s/success.html#access_token=%(username)s%(password)s&expires_in=3600" % { + 'port': self.server.server_port, + 'username': form['username'].value, + 'password': form['password'].value + }) + self.end_headers() + self.server.login_done_event.set() + + +class LocalServer: + def __init__(self): + self.PORT = 5120 + #self.handler = SimpleHTTPServer.SimpleHTTPRequestHandler + self.handler = Handler + self.httpd = BaseHTTPServer.HTTPServer(("localhost", self.PORT), self.handler) + self.httpd.show_login_event = threading.Event() + self.httpd.login_done_event = threading.Event() + self.httpd.socket = ssl.wrap_socket (self.httpd.socket, certfile='/etc/ssl/certs/uoa-test-server.pem', server_side=True) + self.httpd_thread = threading.Thread(target=self.httpd.serve_forever) + + def run(self): + self.httpd_thread.setDaemon(True) + self.httpd_thread.start() + + +class ControlCenterTests(AutopilotTestCase): + def setUp(self): + super(ControlCenterTests, self).setUp() + self.app = self.launch_test_application('gnome-control-center', 'credentials', capture_output=True) + + def test_title(self): + """ Checks whether the Online Accounts window title is correct """ + window = self.app.select_single('GtkApplicationWindow') + self.assertThat(window, NotEquals(None)) + self.assertThat(window.title, Eventually(Equals('Online Accounts'))) + + def test_available_providers(self): + """ Checks whether all the expected providers are available """ + add_account_btn = self.app.select_single('GtkTextCellAccessible', accessible_name=u'Add account…') + self.assertThat(add_account_btn, NotEquals(None)) + + self.mouse.move_to_object(add_account_btn) + self.mouse.click() + + required_providers = [ + 'FakeOAuth', + ] + for provider in required_providers: + provider_item = self.app.select_single('GtkTextCellAccessible', accessible_name=provider) + self.assertThat(add_account_btn, NotEquals(None)) + + def test_create_oauth2_account(self): + """ Test the creation of an OAuth 2.0 account """ + self.server = LocalServer() + self.server.run() + + add_account_btn = self.app.select_single('GtkTextCellAccessible', accessible_name=u'Add account…') + self.assertThat(add_account_btn, NotEquals(None)) + + self.mouse.move_to_object(add_account_btn) + self.mouse.click() + + filter_box = self.app.select_single('GtkComboBoxAccessible', accessible_name='all') + self.assertThat(filter_box, NotEquals(None)) + self.mouse.move_to_object(filter_box) + self.mouse.click() + + sleep(1) + filter_item_test = None + # We can't use select_single, because the menu items appear twice in + # the hirarchy + filter_item_tests = self.app.select_many('GtkMenuItemAccessible', + accessible_name='IntegrationTests') + self.assertThat(len(filter_item_tests), GreaterThan(0)) + filter_item_test = filter_item_tests[0] + self.assertThat(filter_item_test, NotEquals(None)) + self.mouse.move_to_object(filter_item_test) + self.mouse.click() + + sleep(1) + + provider_item = self.app.select_single('GtkTextCellAccessible', accessible_name='FakeOAuth') + self.assertThat(provider_item, NotEquals(None)) + + self.mouse.move_to_object(provider_item) + self.mouse.click() + + # At this point, the signon-ui process should be spawned by D-Bus and + # try to connect to our local webserver. + # Here we wait until we know that the webserver has served the login page: + self.server.httpd.show_login_event.wait(30) + self.assertThat(self.server.httpd.show_login_event.is_set(), Equals(True)) + self.server.httpd.show_login_event.clear() + + # Give some time to signon-ui to render the page + sleep(2) + + # Move to the username field + self.keyboard.press_and_release('Tab') + self.keyboard.press_and_release('Tab') + self.keyboard.press_and_release('Tab') + self.keyboard.press_and_release('Tab') + self.keyboard.type('john') + self.keyboard.press_and_release('Tab') + self.keyboard.type('loser') + self.keyboard.press_and_release('Enter') + + # At this point signon-ui should make a post request with the login + # data; let's wait for it: + self.server.httpd.login_done_event.wait(30) + self.assertThat(self.server.httpd.login_done_event.is_set(), Equals(True)) + self.server.httpd.login_done_event.clear() + + # The account should be created shortly + sleep(5) + account_item = self.app.select_single('GtkTextCellAccessible', accessible_name='FakeOAuth\njohn') + self.assertThat(account_item, NotEquals(None)) + + # Delete it + self.mouse.move_to_object(account_item) + self.mouse.click() + + sleep(1) + remove_button = self.app.select_single('GtkButtonAccessible', accessible_name='Remove Account') + self.assertThat(remove_button, NotEquals(None)) + self.mouse.move_to_object(remove_button) + self.mouse.click() + + sleep(1) + self.keyboard.press_and_release('Tab') + self.keyboard.press_and_release('Enter') + + # Check that the account has been deleted + sleep(1) + account_item = self.app.select_single('GtkTextCellAccessible', accessible_name='FakeOAuth\njohn') + self.assertThat(account_item, Equals(None)) diff -Nru gnome-control-center-signon-0.1.6bzr13.04.05/tests/autopilot/setup.py gnome-control-center-signon-0.1.6bzr13.04.05daily13.05.14ubuntu.unity.next/tests/autopilot/setup.py --- gnome-control-center-signon-0.1.6bzr13.04.05/tests/autopilot/setup.py 1970-01-01 00:00:00.000000000 +0000 +++ gnome-control-center-signon-0.1.6bzr13.04.05daily13.05.14ubuntu.unity.next/tests/autopilot/setup.py 2013-05-14 19:18:48.000000000 +0000 @@ -0,0 +1,13 @@ +#!/usr/bin/env python +# +from distutils.core import setup +from DistUtilsExtra.command import build_extra + +setup(name="gnome-control-center-signon-autopilot", + version="0.1", + author="Alberto Mardegan", + author_email="alberto.mardegan@canonical.com", + url="http://launchpad.net/uoa-integration-tests", + license="GNU General Public License v3 (GPLv3)", + packages=["gnome_control_center_signon"], + cmdclass={"build": build_extra.build_extra,})