Merge lp:~abreu-alexandre/webbrowser-app/add-integration-tests-for-webappcontainer into lp:webbrowser-app

Proposed by Alexandre Abreu
Status: Merged
Merged at revision: 492
Proposed branch: lp:~abreu-alexandre/webbrowser-app/add-integration-tests-for-webappcontainer
Merge into: lp:webbrowser-app
Diff against target: 367 lines (+273/-6)
11 files modified
debian/control (+12/-0)
debian/webapp-container-autopilot.install (+1/-0)
src/app/webcontainer/WebApp.qml (+2/-0)
src/app/webcontainer/webapp-container.cpp (+3/-1)
src/app/webcontainer/webapp-container.qml (+2/-0)
tests/autopilot/CMakeLists.txt (+3/-5)
tests/autopilot/webapp_container/__init__.py (+16/-0)
tests/autopilot/webapp_container/tests/__init__.py (+82/-0)
tests/autopilot/webapp_container/tests/fake_servers.py (+68/-0)
tests/autopilot/webapp_container/tests/test_app_launch.py (+36/-0)
tests/autopilot/webapp_container/tests/test_chrome_setup.py (+48/-0)
To merge this branch: bzr merge lp:~abreu-alexandre/webbrowser-app/add-integration-tests-for-webappcontainer
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Olivier Tilloy Approve
Leo Arias (community) code review Needs Fixing
Review via email: mp+199089@code.launchpad.net

Commit message

Add a basic set of integration tests for the webapp container

Description of the change

Add a basic set of integration tests for the webapp container

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
426. By Alexandre Abreu

Restrict url webapps pattern replacement depending on which part is being affected. Fixes: https://bugs.launchpad.net/bugs/1240685.

Approved by PS Jenkins bot, Olivier Tilloy.

427. By Olivier Tilloy

Ensure the test server is up and responding before starting the tests,
and use standard logging everywhere.

Approved by PS Jenkins bot.

428. By Alexandre Abreu

Fix back forward hud actions.

Approved by Olivier Tilloy, PS Jenkins bot.

429. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

430. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

431. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

Revision history for this message
Olivier Tilloy (osomon) wrote :

When listing the available autopilot tests for webapp_container locally from my development branch (and without the container installed system-wide), I’m getting the following error:

$ autopilot list webapp_container
Loading tests from: /home/osomon/dev/phablet/browser/webbrowser-app/tests/autopilot

Failed to import test module: webapp_container.tests.test_chromeSetup
Traceback (most recent call last):
  File "/usr/lib/python2.7/unittest/loader.py", line 254, in _find_tests
    module = self._get_module_from_name(name)
  File "/usr/lib/python2.7/unittest/loader.py", line 232, in _get_module_from_name
    __import__(name)
  File "/home/osomon/dev/phablet/browser/webbrowser-app/tests/autopilot/webapp_container/tests/__init__.py", line 23, in <module>
    class WebappContainerTestCaseBase(AutopilotTestCase):
  File "/home/osomon/dev/phablet/browser/webbrowser-app/tests/autopilot/webapp_container/tests/__init__.py", line 26, in WebappContainerTestCaseBase
    ['which', 'webapp-container']).strip()
  File "/usr/lib/python2.7/subprocess.py", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
CalledProcessError: Command '['which', 'webapp-container']' returned non-zero exit status 1

The call to subprocess.check_output(…) should be surrounded with a try… except… block.

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

Minor nit:

16 +Description: Webapp container autopilot tests

should be:

    Description: Ubuntu web applications container autopilot tests

Revision history for this message
Olivier Tilloy (osomon) wrote :

set(WEBBROWSER_APP_AUTOPILOT_DIR webbrowser_app)

install(DIRECTORY ${WEBBROWSER_APP_AUTOPILOT_DIR}
    DESTINATION ${PYTHON_PACKAGE_DIR}
    )

set(WEBCONTAINER_AUTOPILOT_DIR webapp_container)

install(DIRECTORY ${WEBCONTAINER_AUTOPILOT_DIR}
    DESTINATION ${PYTHON_PACKAGE_DIR}
    )

This could be simplified to:

    install(DIRECTORY webbrowser_app webapp_container
            DESTINATION ${PYTHON_PACKAGE_DIR}
    )

Revision history for this message
Olivier Tilloy (osomon) wrote :

142 +"""webapp_container autopilot tests and emulators - top level package."""

This one (tests/autopilot/webapp_container/emulators/__init__.py) is not a top-level package. The corresponding file for the browser app (tests/autopilot/webbrowser_app/emulators/__init__.py) is empty except for the copyright header, so this one should have exactly the same contents.

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

Running flake8 on tests/autopilot/webapp_container exhibits 46 errors/warnings. Can you please fix them?

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

241 +class WebappContainerContentHttpServer(threading.Thread):

Can we re-use the test server already present in the tests for webbrowser-app, if it makes sense?

Revision history for this message
Olivier Tilloy (osomon) wrote :

For consistency with the existing tests, can you rename the test methods to use only lowercase and underscores to separate words, like so: "test_loads_with_url" instead of "test_loadsWithUrl".

review: Needs Fixing
Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

All done, besides reusing the test server since I don't want to add extra deps on this, and the commonalities at this point are slim imo,

Revision history for this message
Olivier Tilloy (osomon) wrote :

166 +except:

Unqualified excepts should be avoided as much as possible, they make it hard to spot problems. Please replace with:

    except CalledProcessError:

171 + LOCAL_BROWSER_CONTAINER_PATH_NAME = "%s/%s" % (BASE_FILE_PATH,
172 + CONTAINER_EXEC_REL_PATH)

any reason for not doing this outside the class declaration?

review: Needs Fixing
Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

> 166 +except:
>
> Unqualified excepts should be avoided as much as possible, they make it hard
> to spot problems. Please replace with:
>
> except CalledProcessError:
>
>
> 171 + LOCAL_BROWSER_CONTAINER_PATH_NAME = "%s/%s" % (BASE_FILE_PATH,
> 172 +
> CONTAINER_EXEC_REL_PATH)
>
> any reason for not doing this outside the class declaration?

agree, ... done

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
432. By Olivier Tilloy

Bump version to 0.23 in preparation for the next major release.

433. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

Revision history for this message
Olivier Tilloy (osomon) wrote :

178 + self.pointer = Pointer(Mouse.create())

This fails on devices, where X11 is not available:

Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/webapp_container/tests/test_appLaunch.py", line 19, in setUp
super(WebappContainerAppLaunchTestCase, self).setUp()
File "/usr/lib/python2.7/dist-packages/webapp_container/tests/__init__.py", line 121, in setUp
super(WebappContainerTestCaseWithLocalContentBase, self).setUp()
File "/usr/lib/python2.7/dist-packages/webapp_container/tests/__init__.py", line 38, in setUp
self.pointer = Pointer(Mouse.create())
File "/usr/lib/python2.7/dist-packages/autopilot/input/__init__.py", line 293, in create
"Cannot create a Mouse on devices where X11 is not available."
RuntimeError: Cannot create a Mouse on devices where X11 is not available.

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

180 + def tearDown(self):
181 + super(WebappContainerTestCaseBase, self).tearDown()

If all the method does is call its parent implementation, then it can be removed.

Revision history for this message
Olivier Tilloy (osomon) wrote :

Note for when this MR lands: we will need to update the CI job to also run the webapp_container test suite (currently only the webbrowser_app one is run).

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

all done

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
434. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

435. By David Barth

Re-execute web application in the dedicated container (compatibility mode for legacy webapps).

Approved by PS Jenkins bot, Alexandre Abreu.

436. By PS Jenkins bot

Releasing 0.23+14.04.20140115.1-0ubuntu1 (revision 435 from lp:webbrowser-app).

Approved by PS Jenkins bot.

437. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

438. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

439. By Olivier Tilloy

Work around a bug (regression?) in the UITK by replacing the use of Page by a simple Item. Fixes: https://bugs.launchpad.net/bugs/1270848.

Approved by PS Jenkins bot, Alexandre Abreu, Oliver Grawert.

440. By PS Jenkins bot

Releasing 0.23+14.04.20140120-0ubuntu1 (revision 439 from lp:webbrowser-app).

Approved by PS Jenkins bot.

441. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

442. By Ted Gould

Add URL Dispatcher configuration file.

Approved by PS Jenkins bot, Olivier Tilloy.

443. By Olivier Tilloy

Fix a memory leak when exiting the application.

Approved by Alexandre Abreu, PS Jenkins bot.

444. By Olivier Tilloy

Work around bug #1270848 in a different manner to avoid introducing another regression. Fixes: https://bugs.launchpad.net/bugs/1271436.

Approved by Łukasz Zemczak, PS Jenkins bot.

445. By PS Jenkins bot

Releasing 0.23+14.04.20140122-0ubuntu1 (revision 444 from lp:webbrowser-app).

Approved by PS Jenkins bot.

446. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

ping?

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

When running the tests on my device (with `phablet-test-run -o . webapp_container`), I’m getting 4 occurrences of the same failure:

<failure type="testtools.testresult.real._StringException">_StringException: Empty attachments:
  process-stdout

process-return-code: {{{-6}}}
process-stderr: {{{
/usr/bin/webapp-container: invalid option -- 't'
/usr/bin/webapp-container: invalid option -- 'e'
/usr/bin/webapp-container: invalid option -- 's'
/usr/bin/webapp-container: invalid option -- 't'
/usr/bin/webapp-container: invalid option -- 'a'
/usr/bin/webapp-container: invalid option -- 'b'
/usr/bin/webapp-container: invalid option -- 'i'
/usr/bin/webapp-container: invalid option -- 'l'
/usr/bin/webapp-container: invalid option -- 'i'
/usr/bin/webapp-container: invalid option -- 't'
/usr/bin/webapp-container: invalid option -- 'y'
/usr/bin/webapp-container: unrecognized option '--webapp'
/usr/bin/webapp-container: unrecognized option '--enable-addressbar'
QUbuntu: Could not create application instance
}}}

Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/webapp_container/tests/test_chromeSetup.py", line 42, in test_enable_chrome_address_bar
    self.assertThat(self.get_webcontainer_proxy(), NotEquals(None))
  File "/usr/lib/python2.7/dist-packages/testtools/testcase.py", line 412, in assertThat
    raise MismatchError(matchee, matcher, mismatch, verbose)
MismatchError: None == None

</failure>

review: Needs Fixing
Revision history for this message
Leo Arias (elopio) wrote :

116 +# Copyright 2013 Canonical
130 +# Copyright 2013 Canonical
142 +# Copyright 2013 Canonical
265 +# Copyright 2013 Canonical
296 +# Copyright 2013 Canonical

Please update the copyright years to include 2014.
The other files you touched it might need this too.

124 === added directory 'tests/autopilot/webapp_container/emulators'
125 === added file 'tests/autopilot/webapp_container/emulators/__init__.py'

Why do you need this empty emulators module?

173 + ARGS = []

ARGS is not a constant, so it should be lowercase.

205 +class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
232 +class WebappContainerContentHttpServer(threading.Thread):

To be consistent with what we are doing in other projects, I'd move this clases to a fake_servers.py module.

202 +HTTP_SERVER_PORT = 8383
236 + self.server = BaseHTTPServer.HTTPServer(("", port), RequestHandler)

If you pass 0 as the port, it will get a random free port, which is nice because the port is not released immediately after the server is shut down, so if tests are running too fast you might find that the port is occupied.

262 +++ tests/autopilot/webapp_container/tests/test_appLaunch.py 2014-01-09 17:16:31 +0000

The name of the modules should be all lowercase, so test_app_launch.py

281 + def test_container_does_not_load_with_no_webapp_name_and_url(self):
312 + def test_container_does_not_load_with_no_webapp_and_url(self):

180 + def launch_webcontainer_app(self):

I think it would be clearer if you don't catch the exception here, and just let it go it's way. Then, you can remove from the tests the
326 + self.assertThat(self.get_webcontainer_proxy(), NotEquals(None))
It will just fail if for some reason the app can't be launched.

review: Needs Fixing (code review)
Revision history for this message
Leo Arias (elopio) wrote :

Take a look at how we are starting fake servers as fixtures:
http://bazaar.launchpad.net/~ubuntuone-hackers/unity-scope-click/trunk/view/head:/autopilot/unityclickscope/fixture_setup.py

That's nice because it makes the code a little cleaner, but more important, you don't have to manually add the server stop on the tests, so you won't forget it. And, you will be able to test that your assumptions and preconditions are sane.

447. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

448. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

449. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

450. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

451. By Olivier Tilloy

Do not install the selection event handlers on certain domains known to interfere with touch events. Fixes: 1279903

452. By PS Jenkins bot

Releasing 0.23+14.04.20140219-0ubuntu1

453. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

454. By Alexandre Abreu

Add online account support in the webapp container

455. By PS Jenkins bot

Releasing 0.23+14.04.20140304-0ubuntu1

456. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

457. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

458. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

459. By Timo Jyrinki

Apply the revert that is in archives now, and rebuild against Qt 5.2.1

460. By PS Jenkins bot

Releasing 0.23+14.04.20140313-0ubuntu1

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:429
http://jenkins.qa.ubuntu.com/job/webbrowser-app-ci/637/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/3989
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/3574/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-amd64-ci/139
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-armhf-ci/139
        deb: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-armhf-ci/139/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-i386-ci/139
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3483
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4024
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4024/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3576
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/3576/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/5908/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/4868

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/webbrowser-app-ci/637/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

done & fixed

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
461. By Olivier Tilloy

Do not register private types in the public plugin.
Register them in the webbrowser application scope instead.

I have made sure that private types that were previously public are currently not being used by any application in the store, so this refactoring is safe.

462. By Leo Arias

Updated the copyright header on all the python files.

463. By Adnane Belmadiaf

Fix to open URL that start with / (local files)

464. By Olivier Tilloy

Refactor the test HTTP server to use a random port at startup.

465. By PS Jenkins bot

Releasing 0.23+14.04.20140317-0ubuntu1

466. By Colin Watson

Add multiarch annotations.

467. By PS Jenkins bot

Releasing 0.23+14.04.20140317.1-0ubuntu1

468. By Olivier Tilloy

Use the renderer only once when rendering a thumbnail.
This seems to fix the crash that was happening at destruction time. Fixes: 1294219

469. By PS Jenkins bot

Releasing 0.23+14.04.20140319-0ubuntu1

470. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

471. By Alexandre Abreu

There are 2 ways for the webapp-container to receive a list of patterns to filter url browsing in a webapp container: through the manifest.json file that comes with a given (named) webapp, or through the command line.

At the moment, the 2 mechanisms are exclusive in the sense that from the webapp-container's perspective it only considers one or another when filtering navigation (the webapp manifest one being preferred) but they are NOT semantically equivalent. The list of url patterns in the manifest.json file is use as a mean to filter the urls that are being browsed to, but ALSO in the chromium & FF browsers to know if a webapp is to be installed/enabled when browsing in a given url.

For example, for Gmail, the hostname mail.google.com is used as a trigger to ask the user for an installation/enablement of a webapp in the browser. It is also implicitely used as a filter for browser once in the container.

The issue is that for applications like google services, the authentication mechanism is common. So when launched in the container, the user will be redirected to e.g. https://accounts.google.com or https://accounts.google.ca, etc.

So, the manifest.json cannot be modified to account for those, since we dont want to install a webapp from those URLs but we need a way to add extra navigation url patterns to allow google service webapps to be redirected to e.g. https://accounts.google.* etc.

We provide here 2 things:

- an way for the url patterns passed down from the command line to be also considered in the navigation filtering,
- a way to simplify url patterns for google apps Fixes: 1288982

472. By PS Jenkins bot

Releasing 0.23+14.04.20140324-0ubuntu1

473. By Olivier Tilloy

Land the master Oxide support branch. See individual revisions for details. Fixes: 1271756, 1271759

474. By PS Jenkins bot

Releasing 0.23+14.04.20140328.3-0ubuntu1

475. By PS Jenkins bot

Resync trunk

476. By Launchpad Translations on behalf of phablet-team

Launchpad automatic translations update.

477. By Olivier Tilloy

Null-check to fix a segmentation fault when --help is passed to the executable.

478. By Alexandre Abreu

Small update to the --webapp flag documentation

479. By PS Jenkins bot

Releasing 0.23+14.04.20140402-0ubuntu1

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:477
http://jenkins.qa.ubuntu.com/job/webbrowser-app-ci/682/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4473/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/4073
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-amd64-ci/184
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-armhf-ci/184
        deb: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-armhf-ci/184/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-i386-ci/184
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3864/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4579
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4579/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4108
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4108/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/6323
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5575

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/webbrowser-app-ci/682/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:477
http://jenkins.qa.ubuntu.com/job/webbrowser-app-ci/685/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4485/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/4086/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-amd64-ci/187
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-armhf-ci/187
        deb: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-armhf-ci/187/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-i386-ci/187
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/3875/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4593
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4593/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4120
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4120/artifact/work/output/*zip*/output.zip
    ABORTED: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/6331/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5588

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/webbrowser-app-ci/685/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
480. By Alexandre Abreu

merge trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

The copyright headers of the new python files need to be updated to match those of the existing files. See e.g. tests/autopilot/webbrowser_app/__init__.py

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

I’m getting 13 errors and warnings when running flake8 on tests/autopilot/webapp_container.
Please fix them.

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

54 + else {

For consistency with the rest of the code, please keep the else on the same line as the preceding closing brace.

Revision history for this message
Olivier Tilloy (osomon) wrote :

In RequestHandler.serve_content, you call self.send_response(200), but it has already been called in do_GET.

review: Needs Fixing
Revision history for this message
Olivier Tilloy (osomon) wrote :

For WebappContainerContentHttpServer, you might want to mimick what’s done in HTTPServerInAThread (the implementation was recently changed to not inherit from threading.Thread, which results in better encapsulation and an easier to use class).

Revision history for this message
Olivier Tilloy (osomon) wrote :

It looks to me like test_container_does_not_load_with_no_webapp_name_and_url and test_container_does_not_load_with_no_webapp_and_url do exactly the same thing. Can of one the two be removed?

481. By Alexandre Abreu

update flake8

482. By Alexandre Abreu

better comment

483. By Alexandre Abreu

fixes

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

all done

484. By Alexandre Abreu

fix typo

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

199 + self.http_server.shutdown()

instead of the above, for increased robustness (because if an exception happens, tearDown won’t be called), you should do the following in setUp, just after instantiating self.http_server:

    self.addCleanup(self.http_server.cleanup)

in which case the tearDown method becomes useless and can be removed.

Revision history for this message
Olivier Tilloy (osomon) wrote :

194 + port = self.http_server.server.server_port

to avoid surfacing an implementation detail of WebappContainerContentHttpServer, you could expose a 'port' property on it, like so:

    class WebappContainerContentHttpServer(object):
        […]
        @property
        def port(self):
            return self.server.server_port

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

all done

485. By Alexandre Abreu

fixes

Revision history for this message
Olivier Tilloy (osomon) wrote :

265 + if self.server and self.server:

if True and True ?

self.server will never evaluate to False, as it is assigned in __init__. If the instantiation fails, then __init__ will most likely throw an exception, and the test will blow up anyway, so the 'port' property will never be queried. So I think it should be safe to remove this check.

486. By Alexandre Abreu

remove cruft

Revision history for this message
Alexandre Abreu (abreu-alexandre) wrote :

ok done,

487. By Alexandre Abreu

remove cruft

Revision history for this message
Olivier Tilloy (osomon) wrote :

Looks good now. Thanks!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:485
http://jenkins.qa.ubuntu.com/job/webbrowser-app-ci/725/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4694
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/4133/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-amd64-ci/227
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-armhf-ci/227
        deb: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-armhf-ci/227/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-i386-ci/227
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4050
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4821
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4821/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4277
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4277/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/6368/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5841

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/webbrowser-app-ci/725/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:487
http://jenkins.qa.ubuntu.com/job/webbrowser-app-ci/727/
Executed test runs:
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty/4701/console
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-trusty-touch/4136/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-amd64-ci/229
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-armhf-ci/229
        deb: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-armhf-ci/229/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/webbrowser-app-trusty-i386-ci/229
    FAILURE: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-trusty/4055/console
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4828
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-amd64/4828/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4284
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-trusty-armhf/4284/artifact/work/output/*zip*/output.zip
    FAILURE: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-runner-mako/6371/console
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/5849

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/webbrowser-app-ci/727/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-03-27 16:11:54 +0000
3+++ debian/control 2014-04-09 16:09:26 +0000
4@@ -98,3 +98,15 @@
5 A lightweight web browser tailored for Ubuntu, based on the Webkit rendering
6 engine and using the Ubuntu UI components. This package contains autopilot
7 tests for it.
8+
9+Package: webapp-container-autopilot
10+Architecture: all
11+Depends: ${misc:Depends},
12+ libautopilot-qt (>= 1.4),
13+ libqt5test5,
14+ ubuntu-ui-toolkit-autopilot,
15+ webapp-container (>= ${binary:Version}),
16+Description: Ubuntu web applications container autopilot tests
17+ A lightweight webapps container tailored for Ubuntu, based on the Webkit
18+ rendering engine and using the Ubuntu UI components. This package contains autopilot
19+ tests for it.
20
21=== added file 'debian/webapp-container-autopilot.install'
22--- debian/webapp-container-autopilot.install 1970-01-01 00:00:00 +0000
23+++ debian/webapp-container-autopilot.install 2014-04-09 16:09:26 +0000
24@@ -0,0 +1,1 @@
25+usr/lib/python*/dist-packages/webapp_container/*
26
27=== modified file 'src/app/webcontainer/WebApp.qml'
28--- src/app/webcontainer/WebApp.qml 2014-03-28 16:05:11 +0000
29+++ src/app/webcontainer/WebApp.qml 2014-04-09 16:09:26 +0000
30@@ -26,6 +26,7 @@
31
32 BrowserView {
33 id: webapp
34+ objectName: "webappBrowserView"
35
36 currentWebview: webview.currentWebview
37
38@@ -86,6 +87,7 @@
39
40 PanelLoader {
41 id: panel
42+ objectName: "panel"
43
44 currentWebview: webview.currentWebview
45 chromeless: webapp.chromeless
46
47=== modified file 'src/app/webcontainer/webapp-container.cpp'
48--- src/app/webcontainer/webapp-container.cpp 2014-04-02 15:15:36 +0000
49+++ src/app/webcontainer/webapp-container.cpp 2014-04-09 16:09:26 +0000
50@@ -84,7 +84,9 @@
51 QList<QUrl> urls = this->urls();
52 if (!urls.isEmpty()) {
53 m_window->setProperty("url", urls.first());
54- }
55+ } else {
56+ return false;
57+ }
58 }
59
60 m_component->completeCreate();
61
62=== modified file 'src/app/webcontainer/webapp-container.qml'
63--- src/app/webcontainer/webapp-container.qml 2014-03-21 12:47:26 +0000
64+++ src/app/webcontainer/webapp-container.qml 2014-04-09 16:09:26 +0000
65@@ -21,6 +21,8 @@
66 import Ubuntu.Components 0.1
67
68 Window {
69+ objectName: "webappContainer"
70+
71 property alias developerExtrasEnabled: browser.developerExtrasEnabled
72
73 property alias backForwardButtonsVisible: browser.backForwardButtonsVisible
74
75=== modified file 'tests/autopilot/CMakeLists.txt'
76--- tests/autopilot/CMakeLists.txt 2013-03-08 09:52:30 +0000
77+++ tests/autopilot/CMakeLists.txt 2014-04-09 16:09:26 +0000
78@@ -1,9 +1,7 @@
79-set(AUTOPILOT_DIR webbrowser_app)
80-
81 execute_process(COMMAND python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
82 OUTPUT_VARIABLE PYTHON_PACKAGE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
83
84-install(DIRECTORY ${AUTOPILOT_DIR}
85- DESTINATION ${PYTHON_PACKAGE_DIR}
86- )
87+install(DIRECTORY webbrowser_app webapp_container
88+ DESTINATION ${PYTHON_PACKAGE_DIR}
89+ )
90
91
92=== added directory 'tests/autopilot/webapp_container'
93=== added file 'tests/autopilot/webapp_container/__init__.py'
94--- tests/autopilot/webapp_container/__init__.py 1970-01-01 00:00:00 +0000
95+++ tests/autopilot/webapp_container/__init__.py 2014-04-09 16:09:26 +0000
96@@ -0,0 +1,16 @@
97+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
98+# Copyright 2014 Canonical
99+#
100+# This program is free software: you can redistribute it and/or modify it
101+# under the terms of the GNU General Public License version 3, as published
102+# by the Free Software Foundation.
103+#
104+# This program is distributed in the hope that it will be useful,
105+# but WITHOUT ANY WARRANTY; without even the implied warranty of
106+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
107+# GNU General Public License for more details.
108+#
109+# You should have received a copy of the GNU General Public License
110+# along with this program. If not, see <http://www.gnu.org/licenses/>.
111+
112+"""webapp_container autopilot tests and emulators - top level package."""
113
114=== added directory 'tests/autopilot/webapp_container/tests'
115=== added file 'tests/autopilot/webapp_container/tests/__init__.py'
116--- tests/autopilot/webapp_container/tests/__init__.py 1970-01-01 00:00:00 +0000
117+++ tests/autopilot/webapp_container/tests/__init__.py 2014-04-09 16:09:26 +0000
118@@ -0,0 +1,82 @@
119+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
120+# Copyright 2014 Canonical
121+#
122+# This program is free software: you can redistribute it and/or modify it
123+# under the terms of the GNU General Public License version 3, as published
124+# by the Free Software Foundation.
125+#
126+# This program is distributed in the hope that it will be useful,
127+# but WITHOUT ANY WARRANTY; without even the implied warranty of
128+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
129+# GNU General Public License for more details.
130+#
131+# You should have received a copy of the GNU General Public License
132+# along with this program. If not, see <http://www.gnu.org/licenses/>.
133+
134+""" Autopilot tests for the webapp_container package """
135+
136+import os
137+import subprocess
138+
139+from autopilot.testcase import AutopilotTestCase
140+from autopilot.platform import model
141+
142+from ubuntuuitoolkit import emulators as toolkit_emulators
143+from webapp_container.tests import fake_servers
144+
145+BASE_FILE_PATH = os.path.dirname(os.path.realpath(__file__))
146+CONTAINER_EXEC_REL_PATH = '../../../../src/app/webcontainer/webapp-container'
147+INSTALLED_BROWSER_CONTAINER_PATH_NAME = 'webapp-container'
148+try:
149+ INSTALLED_BROWSER_CONTAINER_PATH_NAME = subprocess.check_output(
150+ ['which', 'webapp-container']).strip()
151+except subprocess.CalledProcessError:
152+ pass
153+
154+LOCAL_BROWSER_CONTAINER_PATH_NAME = "%s/%s" % (BASE_FILE_PATH,
155+ CONTAINER_EXEC_REL_PATH)
156+
157+
158+class WebappContainerTestCaseBase(AutopilotTestCase):
159+ def get_webcontainer_app_path(self):
160+ if os.path.exists(LOCAL_BROWSER_CONTAINER_PATH_NAME):
161+ return LOCAL_BROWSER_CONTAINER_PATH_NAME
162+ return INSTALLED_BROWSER_CONTAINER_PATH_NAME
163+
164+ def launch_webcontainer_app(self, args):
165+ if model() != 'Desktop':
166+ args.append(
167+ '--desktop_file_hint=/usr/share/applications/'
168+ 'webbrowser-app.desktop')
169+ try:
170+ self.app = self.launch_test_application(
171+ self.get_webcontainer_app_path(),
172+ *args,
173+ emulator_base=toolkit_emulators.UbuntuUIToolkitEmulatorBase)
174+ except:
175+ self.app = None
176+
177+ def get_webcontainer_proxy(self):
178+ return self.app
179+
180+ def get_webcontainer_window(self):
181+ return self.app.select_single(objectName="webappContainer")
182+
183+ def get_webcontainer_webview(self):
184+ return self.app.select_single(objectName="webappBrowserView")
185+
186+ def get_webcontainer_panel(self):
187+ return self.app.select_single(objectName="panel")
188+
189+
190+class WebappContainerTestCaseWithLocalContentBase(WebappContainerTestCaseBase):
191+ def setUp(self):
192+ super(WebappContainerTestCaseWithLocalContentBase, self).setUp()
193+ self.http_server = fake_servers.WebappContainerContentHttpServer()
194+ self.addCleanup(self.http_server.shutdown)
195+ self.base_url = "http://localhost:%d" % self.http_server.port
196+
197+ def launch_webcontainer_app_with_local_http_server(self, args, path='/'):
198+ self.url = self.base_url + path
199+ args.append(self.url)
200+ self.launch_webcontainer_app(args)
201
202=== added file 'tests/autopilot/webapp_container/tests/fake_servers.py'
203--- tests/autopilot/webapp_container/tests/fake_servers.py 1970-01-01 00:00:00 +0000
204+++ tests/autopilot/webapp_container/tests/fake_servers.py 2014-04-09 16:09:26 +0000
205@@ -0,0 +1,68 @@
206+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
207+# Copyright 2014 Canonical
208+#
209+# This program is free software: you can redistribute it and/or modify it
210+# under the terms of the GNU General Public License version 3, as published
211+# by the Free Software Foundation.
212+#
213+# This program is distributed in the hope that it will be useful,
214+# but WITHOUT ANY WARRANTY; without even the implied warranty of
215+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
216+# GNU General Public License for more details.
217+#
218+# You should have received a copy of the GNU General Public License
219+# along with this program. If not, see <http://www.gnu.org/licenses/>.
220+
221+""" Autopilot tests for the webapp_container package """
222+
223+import BaseHTTPServer
224+import logging
225+import threading
226+
227+
228+class RequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
229+ def serve_content(self, content, mime_type='text/html'):
230+ self.send_header('Content-type', mime_type)
231+ self.end_headers()
232+ self.wfile.write(content)
233+
234+ def basic_html_content(self):
235+ return """
236+<html>
237+<head>
238+<title>Some content</title>
239+</head>
240+<body>
241+This is some content
242+</body>
243+</html>
244+ """
245+
246+ def do_GET(self):
247+ if self.path == '/':
248+ self.send_response(200)
249+ self.serve_content(self.basic_html_content())
250+ else:
251+ self.send_error(404)
252+
253+
254+class WebappContainerContentHttpServer(object):
255+ def __init__(self):
256+ super(WebappContainerContentHttpServer, self).__init__()
257+ self.server = BaseHTTPServer.HTTPServer(("", 0), RequestHandler)
258+ self.server.allow_reuse_address = True
259+ self.server_thread = threading.Thread(target=self.server.serve_forever)
260+ self.server_thread.start()
261+ logging.info("now serving on port {}".format(self.server.server_port))
262+
263+ @property
264+ def port(self):
265+ return self.server.server_port
266+
267+ def run(self):
268+ self.server.serve_forever()
269+
270+ def shutdown(self):
271+ self.server.shutdown()
272+ self.server.server_close()
273+ self.server_thread.join()
274
275=== added file 'tests/autopilot/webapp_container/tests/test_app_launch.py'
276--- tests/autopilot/webapp_container/tests/test_app_launch.py 1970-01-01 00:00:00 +0000
277+++ tests/autopilot/webapp_container/tests/test_app_launch.py 2014-04-09 16:09:26 +0000
278@@ -0,0 +1,36 @@
279+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
280+# Copyright 2014 Canonical
281+#
282+# This program is free software: you can redistribute it and/or modify it
283+# under the terms of the GNU General Public License version 3, as published
284+# by the Free Software Foundation.
285+#
286+# This program is distributed in the hope that it will be useful,
287+# but WITHOUT ANY WARRANTY; without even the implied warranty of
288+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
289+# GNU General Public License for more details.
290+#
291+# You should have received a copy of the GNU General Public License
292+# along with this program. If not, see <http://www.gnu.org/licenses/>.
293+
294+from __future__ import absolute_import
295+
296+from testtools.matchers import Equals
297+from autopilot.matchers import Eventually
298+
299+from webapp_container.tests import WebappContainerTestCaseWithLocalContentBase
300+
301+
302+class WebappContainerAppLaunchTestCase(
303+ WebappContainerTestCaseWithLocalContentBase):
304+
305+ def test_container_does_not_load_with_no_webapp_name_and_url(self):
306+ args = ['--webapp']
307+ self.launch_webcontainer_app(args)
308+ self.assertThat(self.get_webcontainer_proxy(), Equals(None))
309+
310+ def test_loads_with_url(self):
311+ args = ['--enable-addressbar']
312+ self.launch_webcontainer_app_with_local_http_server(args)
313+ self.assertThat(lambda: self.get_webcontainer_window().url,
314+ Eventually(Equals(self.url)))
315
316=== added file 'tests/autopilot/webapp_container/tests/test_chrome_setup.py'
317--- tests/autopilot/webapp_container/tests/test_chrome_setup.py 1970-01-01 00:00:00 +0000
318+++ tests/autopilot/webapp_container/tests/test_chrome_setup.py 2014-04-09 16:09:26 +0000
319@@ -0,0 +1,48 @@
320+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
321+# Copyright 2014 Canonical
322+#
323+# This program is free software: you can redistribute it and/or modify it
324+# under the terms of the GNU General Public License version 3, as published
325+# by the Free Software Foundation.
326+#
327+# This program is distributed in the hope that it will be useful,
328+# but WITHOUT ANY WARRANTY; without even the implied warranty of
329+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
330+# GNU General Public License for more details.
331+#
332+# You should have received a copy of the GNU General Public License
333+# along with this program. If not, see <http://www.gnu.org/licenses/>.
334+
335+from __future__ import absolute_import
336+
337+from testtools.matchers import Equals, NotEquals
338+
339+from webapp_container.tests import WebappContainerTestCaseWithLocalContentBase
340+
341+
342+class WebappContainerChromeSetupTestCase(
343+ WebappContainerTestCaseWithLocalContentBase):
344+
345+ def test_default_to_chromeless(self):
346+ self.launch_webcontainer_app_with_local_http_server([])
347+ self.assertThat(self.get_webcontainer_proxy(), NotEquals(None))
348+ self.assertThat(self.get_webcontainer_webview().chromeless,
349+ Equals(True))
350+
351+ def test_enable_chrome_back_forward(self):
352+ args = ['--enable-back-forward']
353+ self.launch_webcontainer_app_with_local_http_server(args)
354+ self.assertThat(self.get_webcontainer_webview().chromeless,
355+ Equals(False))
356+ panel = self.get_webcontainer_panel()
357+ self.assertThat(panel.backForwardButtonsVisible,
358+ Equals(True))
359+
360+ def test_enable_chrome_address_bar(self):
361+ args = ['--enable-addressbar']
362+ self.launch_webcontainer_app_with_local_http_server(args)
363+ self.assertThat(self.get_webcontainer_proxy(), NotEquals(None))
364+ self.assertThat(self.get_webcontainer_webview().chromeless,
365+ Equals(False))
366+ self.assertThat(self.get_webcontainer_panel().addressBarVisible,
367+ Equals(True))

Subscribers

People subscribed via source and target branches

to status/vote changes: