Merge lp:~mterry/unity8/simple-lightdm-mock into lp:unity8

Proposed by Michael Terry
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 2751
Merged at revision: 2775
Proposed branch: lp:~mterry/unity8/simple-lightdm-mock
Merge into: lp:unity8
Diff against target: 3068 lines (+646/-1333)
63 files modified
debian/rules (+1/-1)
plugins/LightDM/CMakeLists.txt (+0/-1)
plugins/LightDM/Greeter.cpp (+1/-1)
plugins/LightDM/Greeter.h (+2/-5)
plugins/LightDM/SessionsModel.cpp (+1/-2)
plugins/LightDM/SessionsModel.h (+4/-5)
plugins/LightDM/UsersModel.cpp (+1/-1)
plugins/LightDM/UsersModel.h (+2/-7)
qml/Greeter/LightDMService.qml (+3/-4)
tests/CMakeLists.txt (+1/-1)
tests/autopilot/unity8/fixture_setup.py (+1/-1)
tests/autopilot/unity8/shell/tests/__init__.py (+1/-1)
tests/mocks/AccountsService/AccountsService.cpp (+2/-3)
tests/mocks/AccountsService/AccountsService.h (+3/-6)
tests/mocks/AccountsService/CMakeLists.txt (+1/-2)
tests/mocks/CMakeLists.txt (+2/-1)
tests/mocks/LightDM/CMakeLists.txt (+0/-1)
tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt (+0/-50)
tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp (+0/-51)
tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h (+0/-42)
tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.cpp (+0/-66)
tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.h (+0/-44)
tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp (+0/-44)
tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h (+0/-39)
tests/mocks/LightDM/IntegratedLightDM/QLightDM/Greeter (+0/-17)
tests/mocks/LightDM/IntegratedLightDM/QLightDM/SessionsModel (+0/-17)
tests/mocks/LightDM/IntegratedLightDM/QLightDM/UsersModel (+0/-17)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp (+0/-132)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h (+0/-54)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp (+0/-83)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h (+0/-63)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp (+0/-124)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h (+0/-64)
tests/mocks/LightDM/IntegratedLightDM/plugin.cpp (+0/-79)
tests/mocks/LightDM/IntegratedLightDM/plugin.h (+0/-32)
tests/mocks/LightDM/IntegratedLightDM/qmldir (+0/-2)
tests/mocks/LightDMController/CMakeLists.txt (+15/-0)
tests/mocks/LightDMController/plugin.cpp (+35/-0)
tests/mocks/LightDMController/plugin.h (+29/-0)
tests/mocks/LightDMController/qmldir (+2/-0)
tests/mocks/liblightdm/CMakeLists.txt (+8/-11)
tests/mocks/liblightdm/MockController.cpp (+124/-0)
tests/mocks/liblightdm/MockController.h (+80/-0)
tests/mocks/liblightdm/MockGreeter.cpp (+85/-35)
tests/mocks/liblightdm/MockGreeter.h (+9/-22)
tests/mocks/liblightdm/MockSessionsModel.cpp (+47/-49)
tests/mocks/liblightdm/MockSessionsModel.h (+9/-17)
tests/mocks/liblightdm/MockUsersModel.cpp (+85/-20)
tests/mocks/liblightdm/MockUsersModel.h (+6/-16)
tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt (+3/-3)
tests/plugins/LightDM/IntegratedLightDM/greeter.qml (+2/-7)
tests/plugins/LightDM/IntegratedLightDM/sessionsmodel.cpp (+15/-13)
tests/plugins/LightDM/IntegratedLightDM/usersmodel.cpp (+2/-12)
tests/qmltests/Dash/tst_DashShell.qml (+8/-0)
tests/qmltests/Greeter/TestView.qml (+1/-0)
tests/qmltests/Greeter/tst_Greeter.qml (+6/-8)
tests/qmltests/Greeter/tst_Infographics.qml (+1/-11)
tests/qmltests/Greeter/tst_NarrowView.qml (+9/-2)
tests/qmltests/Greeter/tst_WideView.qml (+20/-30)
tests/qmltests/Tutorial/tst_Tutorial.qml (+3/-3)
tests/qmltests/tst_OrientedShell.qml (+8/-1)
tests/qmltests/tst_Shell.qml (+5/-7)
tests/qmltests/tst_ShellWithPin.qml (+3/-3)
To merge this branch: bzr merge lp:~mterry/unity8/simple-lightdm-mock
Reviewer Review Type Date Requested Status
Unity8 CI Bot continuous-integration Approve
Albert Astals Cid (community) Approve
Review via email: mp+313478@code.launchpad.net

Commit message

Simplify the lightdm mock to make future greeter improvements easier to test.

I simplified the mock liblightdm to avoid separate files for the Private classes. That can all go into the main files. The separation isn't worth wading through the files to find what you want.

And I dropped the mock LightDM plugin entirely. (opting instead for a tiny "mock()" API call on the real plugin that returns an object that can be used to manipulate our mock liblightdm, if we're in testing mode)

Description of the change

Simplify the lightdm mock to make future greeter improvements easier to test.

I simplified the mock liblightdm to avoid separate files for the Private classes. That can all go into the main files. The separation isn't worth wading through the files to find what you want.

And I dropped the mock LightDM plugin entirely. (opting instead for a tiny "mock()" API call on the real plugin that returns an object that can be used to manipulate our mock liblightdm, if we're in testing mode)

To post a comment you must log in.
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2744
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2731/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3586
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2050
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2050
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3614
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3460
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3460/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3460
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3460/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3460
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3460/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3460
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3460/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3460
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3460/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3460
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3460/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2731/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

WideView::test_choosingNewSessionChangesLoginListIcon seems to fail in both xenial and zesty

review: Needs Fixing
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2744
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2749/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3605
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2061
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2061
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3633
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3479
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3479/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3479
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3479/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3479
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3479/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3479
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3479/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3479
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3479/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3479
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3479/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2749/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

I do appreciate that we have dropped quite a bit of code, but I'm not very happy with the mock() API addition, what about http://paste.ubuntu.com/23658647/ ?

review: Needs Fixing
Revision history for this message
Albert Astals Cid (aacid) wrote :

The previous paste was missing the new plugin that exposes the MockController http://paste.ubuntu.com/23658654/

Revision history for this message
Michael Terry (mterry) wrote :

Albert thanks for that! I do like that better. Though I changed from QLightDMController to LightDMController, as a matter of aesthetic preference.

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2747
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2753/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3609
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2064
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2064
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3637
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3483
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3483/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3483
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3483/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3483
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3483/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3483
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3483/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3483
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3483/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3483
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3483/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2753/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2748
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2755/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3613
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2066
    FAILURE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2066/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3641
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3487
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3487/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3487
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3487/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3487
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3487/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3487
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3487/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3487
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3487/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3487
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3487/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2755/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2748
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2757/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3615
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2068
    FAILURE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2068/console
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3643
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3489
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3489/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3489
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3489/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3489
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3489/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3489
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3489/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3489
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3489/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3489
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3489/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2757/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Though i can not reproduce it locally
    WideView::test_choosingNewSessionChangesLoginListIcon
seems to be quite persistent in failing in this branch in CI.

review: Needs Fixing
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

FAILED: Continuous integration, rev:2749
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2833/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3710
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2133
    UNSTABLE: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2133
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3738
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3582
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3582/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3582
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3582/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3582
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3582/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3582
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3582/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3582
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3582/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3582
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3582/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2833/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2750
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2836/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3714
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2137
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2137
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3742
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3586
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3586/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3586
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3586/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3586
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3586/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3586
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3586/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3586
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3586/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3586
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3586/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2836/rebuild

review: Approve (continuous-integration)
Revision history for this message
Michael Terry (mterry) wrote :

OK tests pass again finally. Phew. Ready for re-review. :)

Revision history for this message
Albert Astals Cid (aacid) wrote :

Mock code being removed \o/

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Yes

 * Did CI run pass? If not, please explain why.
Yes

review: Approve
Revision history for this message
Albert Astals Cid (aacid) wrote :

Looooooooooooots of conflicts

review: Needs Fixing
2751. By Michael Terry

Merge trunk

Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2751
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2920/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3811
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2207
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2207
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3839
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3682
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3682/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3682
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3682/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3682
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3682/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3682
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3682/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3682
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3682/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3682
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3682/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2920/rebuild

review: Approve (continuous-integration)
Revision history for this message
Michael Terry (mterry) wrote :

Fixed the conflicts! Phew.

Revision history for this message
Albert Astals Cid (aacid) :
review: Approve
Revision history for this message
Unity8 CI Bot (unity8-ci-bot) wrote :

PASSED: Continuous integration, rev:2751
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2941/
Executed test runs:
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build/3837
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=xenial+overlay,testname=qmluitests.sh/2230
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/test-0-autopkgtest/label=amd64,release=zesty,testname=qmluitests.sh/2230
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-0-fetch/3865
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3708
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=xenial+overlay/3708/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3708
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=amd64,release=zesty/3708/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3708
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=xenial+overlay/3708/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3708
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=armhf,release=zesty/3708/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3708
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=xenial+overlay/3708/artifact/output/*zip*/output.zip
    SUCCESS: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3708
        deb: https://unity8-jenkins.ubuntu.com/job/build-2-binpkg/arch=i386,release=zesty/3708/artifact/output/*zip*/output.zip

Click here to trigger a rebuild:
https://unity8-jenkins.ubuntu.com/job/lp-unity8-ci/2941/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/rules'
2--- debian/rules 2017-01-03 14:02:23 +0000
3+++ debian/rules 2017-01-17 15:40:09 +0000
4@@ -40,4 +40,4 @@
5 override_dh_shlibdeps:
6 # Some mock libraries link against liblightdm-qt5-3.so which we want to
7 # avoid, since we only really link against our mock one, not the system one.
8- dh_shlibdeps -XlibMockLightDM-qml.so -XlibMockAccountsService-qml.so -Lunity8-private
9+ dh_shlibdeps -XlibMockAccountsService-qml.so -Lunity8-private
10
11=== modified file 'plugins/LightDM/CMakeLists.txt'
12--- plugins/LightDM/CMakeLists.txt 2016-03-02 02:54:30 +0000
13+++ plugins/LightDM/CMakeLists.txt 2017-01-17 15:40:09 +0000
14@@ -7,7 +7,6 @@
15 ${CMAKE_CURRENT_SOURCE_DIR}
16 ${CMAKE_CURRENT_BINARY_DIR}
17 ${CMAKE_SOURCE_DIR}/plugins/Utils
18- ${CMAKE_BINARY_DIR}/tests/mocks/LightDM/IntegratedLightDM
19 ${libunity8-private_SOURCE_DIR}
20 ${LIBUSERMETRICSOUTPUT_INCLUDE_DIRS}
21 )
22
23=== modified file 'plugins/LightDM/Greeter.cpp'
24--- plugins/LightDM/Greeter.cpp 2016-07-28 15:34:29 +0000
25+++ plugins/LightDM/Greeter.cpp 2017-01-17 15:40:09 +0000
26@@ -1,5 +1,5 @@
27 /*
28- * Copyright (C) 2013, 2015 Canonical, Ltd.
29+ * Copyright (C) 2013-2016 Canonical, Ltd.
30 *
31 * This program is free software; you can redistribute it and/or modify
32 * it under the terms of the GNU General Public License as published by
33
34=== modified file 'plugins/LightDM/Greeter.h'
35--- plugins/LightDM/Greeter.h 2016-07-28 15:34:29 +0000
36+++ plugins/LightDM/Greeter.h 2017-01-17 15:40:09 +0000
37@@ -1,5 +1,5 @@
38 /*
39- * Copyright (C) 2012,2013,2015 Canonical, Ltd.
40+ * Copyright (C) 2012-2016 Canonical, Ltd.
41 *
42 * This program is free software; you can redistribute it and/or modify
43 * it under the terms of the GNU General Public License as published by
44@@ -21,8 +21,7 @@
45 such edits in the future, and by inserting ourselves here, we have more
46 control. */
47
48-#ifndef UNITY_GREETER_H
49-#define UNITY_GREETER_H
50+#pragma once
51
52 #include <QLightDM/Greeter>
53 #include <QtCore/QObject>
54@@ -81,5 +80,3 @@
55 void showPromptFilter(const QString &text, QLightDM::Greeter::PromptType type);
56 void authenticationCompleteFilter();
57 };
58-
59-#endif
60
61=== modified file 'plugins/LightDM/SessionsModel.cpp'
62--- plugins/LightDM/SessionsModel.cpp 2016-10-07 17:24:55 +0000
63+++ plugins/LightDM/SessionsModel.cpp 2017-01-17 15:40:09 +0000
64@@ -1,5 +1,5 @@
65 /*
66- * Copyright (C) 2015 Canonical, Ltd.
67+ * Copyright (C) 2015-2016 Canonical, Ltd.
68 *
69 * This program is free software; you can redistribute it and/or modify
70 * it under the terms of the GNU General Public License as published by
71@@ -128,7 +128,6 @@
72 }
73
74 setModel(m_model);
75- setSourceModel(m_model);
76 setSortCaseSensitivity(Qt::CaseInsensitive);
77 setSortLocaleAware(true);
78 setSortRole(Qt::DisplayRole);
79
80=== modified file 'plugins/LightDM/SessionsModel.h'
81--- plugins/LightDM/SessionsModel.h 2016-12-23 11:04:53 +0000
82+++ plugins/LightDM/SessionsModel.h 2017-01-17 15:40:09 +0000
83@@ -1,5 +1,5 @@
84 /*
85- * Copyright (C) 2015 Canonical, Ltd.
86+ * Copyright (C) 2015-2016 Canonical, Ltd.
87 *
88 * This program is free software; you can redistribute it and/or modify
89 * it under the terms of the GNU General Public License as published by
90@@ -15,8 +15,7 @@
91 *
92 */
93
94-#ifndef UNITY_SESSIONSMODEL_H
95-#define UNITY_SESSIONSMODEL_H
96+#pragma once
97
98 #include <unitysortfilterproxymodelqml.h>
99 #include <QLightDM/SessionsModel>
100@@ -30,6 +29,7 @@
101
102 Q_PROPERTY(QList<QUrl> iconSearchDirectories READ iconSearchDirectories
103 WRITE setIconSearchDirectories NOTIFY iconSearchDirectoriesChanged)
104+
105 Q_SIGNALS:
106 void iconSearchDirectoriesChanged();
107
108@@ -54,6 +54,7 @@
109 Q_INVOKABLE QUrl iconUrl(const QString sessionName) const;
110
111 void setIconSearchDirectories(const QList<QUrl> searchDirectories);
112+
113 private:
114 QLightDM::SessionsModel* m_model;
115 QHash<int, QByteArray> m_roleNames;
116@@ -63,5 +64,3 @@
117 QUrl("/usr/share/unity-greeter/")};
118
119 };
120-
121-#endif // UNITY_SESSIONSMODEL_H
122
123=== modified file 'plugins/LightDM/UsersModel.cpp'
124--- plugins/LightDM/UsersModel.cpp 2015-10-26 20:15:08 +0000
125+++ plugins/LightDM/UsersModel.cpp 2017-01-17 15:40:09 +0000
126@@ -1,5 +1,5 @@
127 /*
128- * Copyright (C) 2013 Canonical, Ltd.
129+ * Copyright (C) 2013,2015-2016 Canonical, Ltd.
130 *
131 * This program is free software; you can redistribute it and/or modify
132 * it under the terms of the GNU General Public License as published by
133
134=== modified file 'plugins/LightDM/UsersModel.h'
135--- plugins/LightDM/UsersModel.h 2015-09-11 13:38:45 +0000
136+++ plugins/LightDM/UsersModel.h 2017-01-17 15:40:09 +0000
137@@ -1,5 +1,5 @@
138 /*
139- * Copyright (C) 2012,2013 Canonical, Ltd.
140+ * Copyright (C) 2012-2013,2015-2016 Canonical, Ltd.
141 *
142 * This program is free software; you can redistribute it and/or modify
143 * it under the terms of the GNU General Public License as published by
144@@ -12,16 +12,13 @@
145 *
146 * You should have received a copy of the GNU General Public License
147 * along with this program. If not, see <http://www.gnu.org/licenses/>.
148- *
149- * Authors: Michael Terry <michael.terry@canonical.com>
150 */
151
152 /* This class is a really tiny filter around QLightDM::UsersModel. There are
153 some operations that we want to edit a bit for the benefit of Qml.
154 Specifically, we want to sort users according to realName. */
155
156-#ifndef UNITY_USERSMODEL_H
157-#define UNITY_USERSMODEL_H
158+#pragma once
159
160 #include <unitysortfilterproxymodelqml.h>
161 #include <QtCore/QObject>
162@@ -33,5 +30,3 @@
163 public:
164 explicit UsersModel(QObject* parent=0);
165 };
166-
167-#endif
168
169=== modified file 'qml/Greeter/LightDMService.qml'
170--- qml/Greeter/LightDMService.qml 2015-11-19 21:47:32 +0000
171+++ qml/Greeter/LightDMService.qml 2017-01-17 15:40:09 +0000
172@@ -35,10 +35,9 @@
173 // This trickery handles cases where applicationArguments aren't provided
174 // such as during testing
175 property var fullLightDM: {
176- if (typeof applicationArguments !== "undefined") {
177- if (applicationArguments.mode === "greeter") {
178- return true;
179- }
180+ if (typeof applicationArguments === "undefined" ||
181+ applicationArguments.mode === "greeter") {
182+ return true;
183 }
184 return false;
185 }
186
187=== modified file 'tests/CMakeLists.txt'
188--- tests/CMakeLists.txt 2016-12-06 20:16:56 +0000
189+++ tests/CMakeLists.txt 2017-01-17 15:40:09 +0000
190@@ -42,8 +42,8 @@
191
192 set(ld_paths)
193 list(APPEND ld_paths
194+ ${UNITY_MOCKPATH}/liblightdm
195 ${UNITY_MOCKPATH}/libusermetrics
196- ${UNITY_MOCKPATH}/LightDM/IntegratedLightDM/liblightdm
197 )
198
199 string(REPLACE ";" ":" ld_library_path "${ld_paths}")
200
201=== modified file 'tests/autopilot/unity8/fixture_setup.py'
202--- tests/autopilot/unity8/fixture_setup.py 2015-10-26 20:15:08 +0000
203+++ tests/autopilot/unity8/fixture_setup.py 2017-01-17 15:40:09 +0000
204@@ -74,7 +74,7 @@
205 def _get_lightdm_mock_path(self):
206 lib_path = get_mocks_library_path()
207 lightdm_mock_path = os.path.abspath(
208- os.path.join(lib_path, "LightDM" ,"IntegratedLightDM", "liblightdm")
209+ os.path.join(lib_path, "liblightdm")
210 )
211
212 if not os.path.exists(lightdm_mock_path):
213
214=== modified file 'tests/autopilot/unity8/shell/tests/__init__.py'
215--- tests/autopilot/unity8/shell/tests/__init__.py 2016-10-25 13:11:19 +0000
216+++ tests/autopilot/unity8/shell/tests/__init__.py 2017-01-17 15:40:09 +0000
217@@ -264,7 +264,7 @@
218 def _get_lightdm_mock_path(self):
219 lib_path = get_mocks_library_path()
220 lightdm_mock_path = os.path.abspath(
221- os.path.join(lib_path, "LightDM" ,"IntegratedLightDM", "liblightdm")
222+ os.path.join(lib_path, "liblightdm")
223 )
224
225 if not os.path.exists(lightdm_mock_path):
226
227=== modified file 'tests/mocks/AccountsService/AccountsService.cpp'
228--- tests/mocks/AccountsService/AccountsService.cpp 2016-08-04 14:05:54 +0000
229+++ tests/mocks/AccountsService/AccountsService.cpp 2017-01-17 15:40:09 +0000
230@@ -15,7 +15,7 @@
231 */
232
233 #include "AccountsService.h"
234-#include "MockUsersModel.h"
235+#include "UsersModel.h"
236
237 #include <QLightDM/UsersModel>
238 #include <paths.h>
239@@ -33,9 +33,8 @@
240 m_demoEdgesCompleted(),
241 m_hereEnabled(false),
242 m_hereLicensePath(""),
243- m_usersModel(new MockUsersModel(this))
244+ m_usersModel(new UsersModel(this))
245 {
246- m_usersModel->setMockMode("full");
247 }
248
249 QString AccountsService::user() const
250
251=== modified file 'tests/mocks/AccountsService/AccountsService.h'
252--- tests/mocks/AccountsService/AccountsService.h 2016-12-23 11:04:53 +0000
253+++ tests/mocks/AccountsService/AccountsService.h 2017-01-17 15:40:09 +0000
254@@ -14,15 +14,14 @@
255 * along with this program. If not, see <http://www.gnu.org/licenses/>.
256 */
257
258-#ifndef UNITY_MOCK_ACCOUNTSSERVICE_H
259-#define UNITY_MOCK_ACCOUNTSSERVICE_H
260+#pragma once
261
262 #include <QObject>
263 #include <QString>
264 #include <QStringList>
265 #include <QVariant>
266
267-class MockUsersModel;
268+class UsersModel;
269
270 class AccountsService: public QObject
271 {
272@@ -165,7 +164,5 @@
273 QString m_realName;
274 QStringList m_kbdMap;
275 QString m_email;
276- MockUsersModel *m_usersModel;
277+ UsersModel *m_usersModel;
278 };
279-
280-#endif
281
282=== modified file 'tests/mocks/AccountsService/CMakeLists.txt'
283--- tests/mocks/AccountsService/CMakeLists.txt 2016-12-06 20:16:56 +0000
284+++ tests/mocks/AccountsService/CMakeLists.txt 2017-01-17 15:40:09 +0000
285@@ -1,14 +1,13 @@
286 include_directories(
287 ${CMAKE_CURRENT_BINARY_DIR}
288 ${CMAKE_SOURCE_DIR}/plugins/LightDM
289+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM
290 ${CMAKE_SOURCE_DIR}/plugins/Utils
291- ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
292 )
293
294 add_library(MockAccountsService-qml MODULE
295 ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
296 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
297- ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp
298 AccountsService.cpp
299 plugin.cpp
300 )
301
302=== modified file 'tests/mocks/CMakeLists.txt'
303--- tests/mocks/CMakeLists.txt 2016-12-06 20:16:56 +0000
304+++ tests/mocks/CMakeLists.txt 2017-01-17 15:40:09 +0000
305@@ -32,8 +32,9 @@
306 add_subdirectory(Cursor)
307 add_subdirectory(GSettings.1.0)
308 add_subdirectory(indicator-service)
309+add_subdirectory(liblightdm)
310 add_subdirectory(libusermetrics)
311-add_subdirectory(LightDM)
312+add_subdirectory(LightDMController)
313 add_subdirectory(Lights)
314 add_subdirectory(MeeGo)
315 add_subdirectory(Powerd)
316
317=== removed directory 'tests/mocks/LightDM'
318=== removed file 'tests/mocks/LightDM/CMakeLists.txt'
319--- tests/mocks/LightDM/CMakeLists.txt 2015-09-25 13:01:00 +0000
320+++ tests/mocks/LightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000
321@@ -1,1 +0,0 @@
322-add_subdirectory(IntegratedLightDM)
323
324=== removed directory 'tests/mocks/LightDM/IntegratedLightDM'
325=== removed file 'tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt'
326--- tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt 2016-07-14 13:04:10 +0000
327+++ tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt 1970-01-01 00:00:00 +0000
328@@ -1,50 +0,0 @@
329-# This is a copy of the normal LightDM plugin, but instead of statically
330-# linking in the lightdm bits, this one uses shared libraries so we can swap
331-# out different sets of users for different tests. When we finally switch to
332-# actually using the system liblightdm in the normal plugin, this version can
333-# be deleted.
334-
335-add_subdirectory(liblightdm)
336-
337-include_directories(
338- ${CMAKE_CURRENT_SOURCE_DIR}
339- ${CMAKE_CURRENT_BINARY_DIR}
340- ${CMAKE_SOURCE_DIR}/plugins/Utils
341- ${CMAKE_SOURCE_DIR}/plugins/LightDM
342- ${CMAKE_SOURCE_DIR}/tests/mocks/libusermetrics
343- ${libunity8-private_SOURCE_DIR}
344-)
345-
346-set(QMLPLUGIN_SRC
347- ${CMAKE_SOURCE_DIR}/plugins/LightDM/DBusGreeter.cpp
348- ${CMAKE_SOURCE_DIR}/plugins/LightDM/DBusGreeterList.cpp
349- ${CMAKE_SOURCE_DIR}/plugins/LightDM/Greeter.cpp
350- ${CMAKE_SOURCE_DIR}/plugins/LightDM/SessionsModel.cpp
351- ${CMAKE_SOURCE_DIR}/plugins/LightDM/UsersModel.cpp
352- ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
353- MockGreeter.cpp
354- MockSessionsModel.cpp
355- MockUsersModel.cpp
356- plugin.cpp
357- )
358-
359-add_library(MockLightDM-qml MODULE
360- ${QMLPLUGIN_SRC}
361- )
362-
363-# We want to link to liblightdm-qt5-3, but we don't want to depend on it being
364-# installed on the system. So we make sure we link to our full fake version
365-# At run time, we can point to whichever version we happen to be using via
366-# LD_LIBRARY_PATH.
367-target_link_libraries(MockLightDM-qml
368- MockLightDM
369- MockUserMetrics
370- unity8-private
371- )
372-
373-qt5_use_modules(MockLightDM-qml DBus Gui Qml)
374-
375-add_unity8_mock(LightDM.IntegratedLightDM 0.1 LightDM/IntegratedLightDM
376- TARGETS MockLightDM-qml
377- ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/liblightdm"
378-)
379
380=== removed file 'tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp'
381--- tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp 2016-06-09 21:45:09 +0000
382+++ tests/mocks/LightDM/IntegratedLightDM/MockGreeter.cpp 1970-01-01 00:00:00 +0000
383@@ -1,51 +0,0 @@
384-/*
385- * Copyright (C) 2014 Canonical, Ltd.
386- *
387- * This program is free software; you can redistribute it and/or modify
388- * it under the terms of the GNU General Public License as published by
389- * the Free Software Foundation; version 3.
390- *
391- * This program is distributed in the hope that it will be useful,
392- * but WITHOUT ANY WARRANTY; without even the implied warranty of
393- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
394- * GNU General Public License for more details.
395- *
396- * You should have received a copy of the GNU General Public License
397- * along with this program. If not, see <http://www.gnu.org/licenses/>.
398- *
399- */
400-
401-#include "MockGreeter.h"
402-#include <GreeterPrivate.h>
403-
404-QString MockGreeter::mockMode() const
405-{
406- Q_D(const Greeter);
407- return d->m_greeter->mockMode();
408-}
409-
410-void MockGreeter::setMockMode(QString mockMode)
411-{
412- Q_D(Greeter);
413-
414- if (d->m_greeter->mockMode() != mockMode) {
415- d->m_greeter->setMockMode(mockMode);
416- Q_EMIT mockModeChanged(mockMode);
417- }
418-}
419-
420-QString MockGreeter::selectUserHint() const
421-{
422- Q_D(const Greeter);
423- return d->m_greeter->selectUserHint();
424-}
425-
426-void MockGreeter::setSelectUserHint(const QString &selectUserHint)
427-{
428- Q_D(Greeter);
429-
430- if (d->m_greeter->selectUserHint() != selectUserHint) {
431- d->m_greeter->setSelectUserHint(selectUserHint);
432- Q_EMIT selectUserHintChanged();
433- }
434-}
435
436=== removed file 'tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h'
437--- tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h 2016-06-09 21:45:09 +0000
438+++ tests/mocks/LightDM/IntegratedLightDM/MockGreeter.h 1970-01-01 00:00:00 +0000
439@@ -1,42 +0,0 @@
440-/*
441- * Copyright (C) 2014 Canonical, Ltd.
442- *
443- * This program is free software; you can redistribute it and/or modify
444- * it under the terms of the GNU General Public License as published by
445- * the Free Software Foundation; version 3.
446- *
447- * This program is distributed in the hope that it will be useful,
448- * but WITHOUT ANY WARRANTY; without even the implied warranty of
449- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
450- * GNU General Public License for more details.
451- *
452- * You should have received a copy of the GNU General Public License
453- * along with this program. If not, see <http://www.gnu.org/licenses/>.
454- *
455- */
456-
457-// The real, production, Greeter
458-#include <Greeter.h>
459-
460-#ifndef MOCK_UNITY_GREETER_H
461-#define MOCK_UNITY_GREETER_H
462-
463-class MockGreeter : public Greeter {
464- Q_OBJECT
465-
466- Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
467- Q_PROPERTY(QString selectUser READ selectUserHint WRITE setSelectUserHint NOTIFY selectUserHintChanged)
468-
469-public:
470- QString mockMode() const;
471- void setMockMode(QString mockMode);
472-
473- QString selectUserHint() const;
474- void setSelectUserHint(const QString &selectUserHint);
475-
476-Q_SIGNALS:
477- void mockModeChanged(QString mode);
478- void selectUserHintChanged();
479-};
480-
481-#endif // MOCK_UNITY_GREETER_H
482
483=== removed file 'tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.cpp'
484--- tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.cpp 2016-07-13 20:24:24 +0000
485+++ tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.cpp 1970-01-01 00:00:00 +0000
486@@ -1,66 +0,0 @@
487-/*
488- * Copyright (C) 2015 Canonical, Ltd.
489- *
490- * This program is free software; you can redistribute it and/or modify
491- * it under the terms of the GNU General Public License as published by
492- * the Free Software Foundation; version 3.
493- *
494- * This program is distributed in the hope that it will be useful,
495- * but WITHOUT ANY WARRANTY; without even the implied warranty of
496- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
497- * GNU General Public License for more details.
498- *
499- * You should have received a copy of the GNU General Public License
500- * along with this program. If not, see <http://www.gnu.org/licenses/>.
501- *
502- */
503-
504-#include "MockSessionsModel.h"
505-#include <QLightDM/SessionsModel>
506-
507-
508-int MockSessionsModel::numSessions() const
509-{
510- QLightDM::SessionsModel* qSessionsModel =
511- static_cast<QLightDM::SessionsModel*>(sourceModel());
512-
513- return qSessionsModel->numSessions();
514-}
515-
516-int MockSessionsModel::numAvailableSessions() const
517-{
518- QLightDM::SessionsModel* qSessionsModel =
519- static_cast<QLightDM::SessionsModel*>(sourceModel());
520-
521- return qSessionsModel->numAvailableSessions();
522-}
523-
524-QString MockSessionsModel::testScenario() const
525-{
526- QLightDM::SessionsModel* qSessionsModel =
527- static_cast<QLightDM::SessionsModel*>(sourceModel());
528-
529- return qSessionsModel->testScenario();
530-}
531-
532-void MockSessionsModel::setNumSessions(const int numSessions)
533-{
534- QLightDM::SessionsModel* qSessionsModel =
535- static_cast<QLightDM::SessionsModel*>(sourceModel());
536-
537- if (qSessionsModel->numSessions() != numSessions) {
538- qSessionsModel->setNumSessions(numSessions);
539- Q_EMIT numSessionsChanged();
540- }
541-}
542-
543-void MockSessionsModel::setTestScenario(const QString testScenario)
544-{
545- QLightDM::SessionsModel* qSessionsModel =
546- static_cast<QLightDM::SessionsModel*>(sourceModel());
547-
548- if (qSessionsModel->testScenario() != testScenario) {
549- qSessionsModel->setTestScenario(testScenario);
550- Q_EMIT testScenarioChanged();
551- }
552-}
553
554=== removed file 'tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.h'
555--- tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.h 2016-07-13 20:24:24 +0000
556+++ tests/mocks/LightDM/IntegratedLightDM/MockSessionsModel.h 1970-01-01 00:00:00 +0000
557@@ -1,44 +0,0 @@
558-/*
559- * Copyright (C) 2015 Canonical, Ltd.
560- *
561- * This program is free software; you can redistribute it and/or modify
562- * it under the terms of the GNU General Public License as published by
563- * the Free Software Foundation; version 3.
564- *
565- * This program is distributed in the hope that it will be useful,
566- * but WITHOUT ANY WARRANTY; without even the implied warranty of
567- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
568- * GNU General Public License for more details.
569- *
570- * You should have received a copy of the GNU General Public License
571- * along with this program. If not, see <http://www.gnu.org/licenses/>.
572- *
573- */
574-
575-#ifndef MOCK_UNITY_SESSIONSMODEL_H
576-#define MOCK_UNITY_SESSIONSMODEL_H
577-
578-#include <SessionsModel.h>
579-
580-class MockSessionsModel : public SessionsModel
581-{
582- Q_OBJECT
583-
584- Q_PROPERTY(int numAvailableSessions READ numAvailableSessions CONSTANT)
585- Q_PROPERTY(int numSessions READ numSessions WRITE setNumSessions NOTIFY numSessionsChanged)
586- Q_PROPERTY(QString testScenario READ testScenario WRITE setTestScenario NOTIFY testScenarioChanged)
587-
588-public:
589- int numAvailableSessions() const;
590- int numSessions() const;
591- QString testScenario() const;
592- void setNumSessions(const int numSessions);
593- void setTestScenario(const QString testScenario);
594-
595-Q_SIGNALS:
596- void numSessionsChanged();
597- void testScenarioChanged();
598-
599-};
600-
601-#endif // MOCK_UNITY_SESSIONSMODEL_H
602
603=== removed file 'tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp'
604--- tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp 2016-08-04 14:05:54 +0000
605+++ tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.cpp 1970-01-01 00:00:00 +0000
606@@ -1,44 +0,0 @@
607-/*
608- * Copyright (C) 2014 Canonical, Ltd.
609- *
610- * This program is free software; you can redistribute it and/or modify
611- * it under the terms of the GNU General Public License as published by
612- * the Free Software Foundation; version 3.
613- *
614- * This program is distributed in the hope that it will be useful,
615- * but WITHOUT ANY WARRANTY; without even the implied warranty of
616- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
617- * GNU General Public License for more details.
618- *
619- * You should have received a copy of the GNU General Public License
620- * along with this program. If not, see <http://www.gnu.org/licenses/>.
621- *
622- */
623-
624-#include "MockUsersModel.h"
625-#include <QLightDM/UsersModel>
626-#include <QSortFilterProxyModel>
627-
628-MockUsersModel::MockUsersModel(QObject* parent)
629- : UsersModel(parent)
630-{
631-}
632-
633-QString MockUsersModel::mockMode() const
634-{
635- QLightDM::UsersModel* qUsersModel =
636- static_cast<QLightDM::UsersModel*>(static_cast<QSortFilterProxyModel*>(sourceModel())->sourceModel());
637-
638- return qUsersModel->mockMode();
639-}
640-
641-void MockUsersModel::setMockMode(QString mockMode)
642-{
643- QLightDM::UsersModel* qUsersModel =
644- static_cast<QLightDM::UsersModel*>(static_cast<QSortFilterProxyModel*>(sourceModel())->sourceModel());
645-
646- if (qUsersModel->mockMode() != mockMode) {
647- qUsersModel->setMockMode(mockMode);
648- Q_EMIT mockModeChanged(mockMode);
649- }
650-}
651
652=== removed file 'tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h'
653--- tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h 2016-08-04 14:05:54 +0000
654+++ tests/mocks/LightDM/IntegratedLightDM/MockUsersModel.h 1970-01-01 00:00:00 +0000
655@@ -1,39 +0,0 @@
656-/*
657- * Copyright (C) 2014 Canonical, Ltd.
658- *
659- * This program is free software; you can redistribute it and/or modify
660- * it under the terms of the GNU General Public License as published by
661- * the Free Software Foundation; version 3.
662- *
663- * This program is distributed in the hope that it will be useful,
664- * but WITHOUT ANY WARRANTY; without even the implied warranty of
665- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
666- * GNU General Public License for more details.
667- *
668- * You should have received a copy of the GNU General Public License
669- * along with this program. If not, see <http://www.gnu.org/licenses/>.
670- *
671- */
672-
673-#ifndef MOCK_UNITY_USERSMODEL_H
674-#define MOCK_UNITY_USERSMODEL_H
675-
676-#include <UsersModel.h>
677-
678-class MockUsersModel : public UsersModel
679-{
680- Q_OBJECT
681-
682- Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
683-
684-public:
685- explicit MockUsersModel(QObject* parent=0);
686-
687- QString mockMode() const;
688- void setMockMode(QString mockMode);
689-
690-Q_SIGNALS:
691- void mockModeChanged(QString mode);
692-};
693-
694-#endif // MOCK_UNITY_USERSMODEL_H
695
696=== removed directory 'tests/mocks/LightDM/IntegratedLightDM/QLightDM'
697=== removed file 'tests/mocks/LightDM/IntegratedLightDM/QLightDM/Greeter'
698--- tests/mocks/LightDM/IntegratedLightDM/QLightDM/Greeter 2015-01-20 11:50:19 +0000
699+++ tests/mocks/LightDM/IntegratedLightDM/QLightDM/Greeter 1970-01-01 00:00:00 +0000
700@@ -1,17 +0,0 @@
701-/*
702- * Copyright (C) 2014 Canonical, Ltd.
703- *
704- * This program is free software; you can redistribute it and/or modify
705- * it under the terms of the GNU General Public License as published by
706- * the Free Software Foundation; version 3.
707- *
708- * This program is distributed in the hope that it will be useful,
709- * but WITHOUT ANY WARRANTY; without even the implied warranty of
710- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
711- * GNU General Public License for more details.
712- *
713- * You should have received a copy of the GNU General Public License
714- * along with this program. If not, see <http://www.gnu.org/licenses/>.
715- */
716-
717-#include "../liblightdm/Greeter.h"
718
719=== removed file 'tests/mocks/LightDM/IntegratedLightDM/QLightDM/SessionsModel'
720--- tests/mocks/LightDM/IntegratedLightDM/QLightDM/SessionsModel 2015-11-18 03:52:01 +0000
721+++ tests/mocks/LightDM/IntegratedLightDM/QLightDM/SessionsModel 1970-01-01 00:00:00 +0000
722@@ -1,17 +0,0 @@
723-/*
724- * Copyright (C) 2015 Canonical, Ltd.
725- *
726- * This program is free software; you can redistribute it and/or modify
727- * it under the terms of the GNU General Public License as published by
728- * the Free Software Foundation; version 3.
729- *
730- * This program is distributed in the hope that it will be useful,
731- * but WITHOUT ANY WARRANTY; without even the implied warranty of
732- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
733- * GNU General Public License for more details.
734- *
735- * You should have received a copy of the GNU General Public License
736- * along with this program. If not, see <http://www.gnu.org/licenses/>.
737- */
738-
739-#include "../liblightdm/SessionsModel.h"
740
741=== removed file 'tests/mocks/LightDM/IntegratedLightDM/QLightDM/UsersModel'
742--- tests/mocks/LightDM/IntegratedLightDM/QLightDM/UsersModel 2015-01-20 11:50:19 +0000
743+++ tests/mocks/LightDM/IntegratedLightDM/QLightDM/UsersModel 1970-01-01 00:00:00 +0000
744@@ -1,17 +0,0 @@
745-/*
746- * Copyright (C) 2014 Canonical, Ltd.
747- *
748- * This program is free software; you can redistribute it and/or modify
749- * it under the terms of the GNU General Public License as published by
750- * the Free Software Foundation; version 3.
751- *
752- * This program is distributed in the hope that it will be useful,
753- * but WITHOUT ANY WARRANTY; without even the implied warranty of
754- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
755- * GNU General Public License for more details.
756- *
757- * You should have received a copy of the GNU General Public License
758- * along with this program. If not, see <http://www.gnu.org/licenses/>.
759- */
760-
761-#include "../liblightdm/UsersModel.h"
762
763=== removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp'
764--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp 2016-06-09 21:45:09 +0000
765+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.cpp 1970-01-01 00:00:00 +0000
766@@ -1,132 +0,0 @@
767-/*
768- * Copyright (C) 2014 Canonical, Ltd.
769- *
770- * This program is free software; you can redistribute it and/or modify
771- * it under the terms of the GNU General Public License as published by
772- * the Free Software Foundation; version 3.
773- *
774- * This program is distributed in the hope that it will be useful,
775- * but WITHOUT ANY WARRANTY; without even the implied warranty of
776- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
777- * GNU General Public License for more details.
778- *
779- * You should have received a copy of the GNU General Public License
780- * along with this program. If not, see <http://www.gnu.org/licenses/>.
781- */
782-
783-#include "Greeter.h"
784-#include "GreeterPrivate.h"
785-
786-namespace QLightDM
787-{
788-
789-GreeterPrivate::GreeterPrivate(Greeter* parent)
790- : authenticated(false),
791- authenticationUser(),
792- twoFactorDone(false),
793- mockMode("single"),
794- q_ptr(parent)
795-{
796- char *envMockMode = getenv("LIBLIGHTDM_MOCK_MODE");
797- if (envMockMode) {
798- mockMode = envMockMode;
799- }
800-}
801-
802-void GreeterPrivate::handleAuthenticate()
803-{
804- Q_Q(Greeter);
805-
806- if (mockMode == "single") {
807- authenticated = true;
808- Q_EMIT q->authenticationComplete();
809- } else if (mockMode == "single-passphrase" || mockMode == "single-pin") {
810- Q_EMIT q->showPrompt("Password: ", Greeter::PromptTypeSecret);
811- } else if (mockMode == "full") {
812- handleAuthenticate_full();
813- }
814-}
815-
816-void GreeterPrivate::handleAuthenticate_full()
817-{
818- Q_Q(Greeter);
819-
820- // Send out any messages we need to
821- if (authenticationUser == "info-prompt")
822- Q_EMIT q->showMessage("Welcome to Unity Greeter", Greeter::MessageTypeInfo);
823- else if (authenticationUser == "wide-info-prompt")
824- Q_EMIT q->showMessage("Welcome to Unity Greeter, the greeteriest greeter that ever did appear in these fine lands", Greeter::MessageTypeInfo);
825- else if (authenticationUser == "html-info-prompt")
826- Q_EMIT q->showMessage("<b>&</b>", Greeter::MessageTypeInfo);
827- else if (authenticationUser == "long-info-prompt")
828- Q_EMIT q->showMessage("Welcome to Unity Greeter\n\nWe like to annoy you with super ridiculously long messages.\nLike this one\n\nThis is the last line of a multiple line message.", Greeter::MessageTypeInfo);
829- else if (authenticationUser == "multi-info-prompt") {
830- Q_EMIT q->showMessage("Welcome to Unity Greeter", Greeter::MessageTypeInfo);
831- Q_EMIT q->showMessage("This is an error", Greeter::MessageTypeError);
832- Q_EMIT q->showMessage("You should have seen three messages", Greeter::MessageTypeInfo);
833- }
834-
835- // OK, now actually do the prompt
836- if (authenticationUser == "no-password") {
837- authenticated = true;
838- Q_EMIT q->authenticationComplete();
839- } else if (authenticationUser == "has-pin"){
840- Q_EMIT q->showPrompt("Password: ", Greeter::PromptTypeSecret);
841- } else if (authenticationUser == "auth-error") {
842- authenticated = false;
843- Q_EMIT q->authenticationComplete();
844- } else if (authenticationUser == "different-prompt") {
845- Q_EMIT q->showPrompt("Secret word: ", Greeter::PromptTypeSecret);
846- } else {
847- Q_EMIT q->showPrompt("Password: ", Greeter::PromptTypeSecret);
848- }
849-}
850-
851-void GreeterPrivate::handleRespond(QString const &response)
852-{
853- Q_Q(Greeter);
854-
855- if (mockMode == "single") {
856- // NOOP
857- } else if (mockMode == "single-passphrase") {
858- authenticated = (response == "password");
859- q->sendAuthenticationComplete();
860- } else if (mockMode == "single-pin") {
861- authenticated = (response == "1234");
862- q->sendAuthenticationComplete();
863- } else if (mockMode == "full") {
864- handleRespond_full(response);
865- }
866-}
867-
868-void GreeterPrivate::handleRespond_full(const QString &response)
869-{
870- Q_Q(Greeter);
871-
872- if (authenticationUser == "no-response")
873- return;
874- else if (authenticationUser == "two-factor") {
875- if (!twoFactorDone) {
876- if (response == "password") {
877- twoFactorDone = true;
878- Q_EMIT q->showPrompt("otp", Greeter::PromptTypeQuestion);
879- } else {
880- authenticated = false;
881- q->sendAuthenticationComplete();
882- }
883- } else {
884- authenticated = (response == "otp");
885- q->sendAuthenticationComplete();
886- }
887- return;
888- }
889-
890- if (authenticationUser == "has-pin") {
891- authenticated = (response == "1234");
892- } else {
893- authenticated = (response == "password");
894- }
895- q->sendAuthenticationComplete();
896-}
897-
898-}
899
900=== removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h'
901--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h 2016-06-09 21:45:09 +0000
902+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/GreeterPrivate.h 1970-01-01 00:00:00 +0000
903@@ -1,54 +0,0 @@
904-/*
905- * Copyright (C) 2014 Canonical, Ltd.
906- *
907- * This program is free software; you can redistribute it and/or modify
908- * it under the terms of the GNU General Public License as published by
909- * the Free Software Foundation; version 3.
910- *
911- * This program is distributed in the hope that it will be useful,
912- * but WITHOUT ANY WARRANTY; without even the implied warranty of
913- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
914- * GNU General Public License for more details.
915- *
916- * You should have received a copy of the GNU General Public License
917- * along with this program. If not, see <http://www.gnu.org/licenses/>.
918- */
919-
920-#ifndef UNITY_MOCK_GREETER_PRIVATE_H
921-#define UNITY_MOCK_GREETER_PRIVATE_H
922-
923-#include <QtCore/QObject>
924-
925-namespace QLightDM
926-{
927-class Greeter;
928-class GreeterImpl;
929-
930-class GreeterPrivate
931-{
932-public:
933- explicit GreeterPrivate(Greeter* parent=0);
934- virtual ~GreeterPrivate() = default;
935-
936- // These variables may not be used by all subclasses, that's no problem
937- bool authenticated;
938- QString authenticationUser;
939- bool twoFactorDone;
940- QString selectUserHint;
941-
942- QString mockMode;
943-
944- void handleAuthenticate();
945- void handleRespond(const QString &response);
946-
947-protected:
948- Greeter * const q_ptr;
949-
950-private:
951- void handleAuthenticate_full();
952- void handleRespond_full(const QString &response);
953- Q_DECLARE_PUBLIC(Greeter)
954-};
955-}
956-
957-#endif // UNITY_MOCK_GREETER_PRIVATE_H
958
959=== removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp'
960--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp 2016-11-28 10:19:39 +0000
961+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.cpp 1970-01-01 00:00:00 +0000
962@@ -1,83 +0,0 @@
963-/*
964- * Copyright (C) 2015 Canonical, Ltd.
965- *
966- * This program is free software; you can redistribute it and/or modify
967- * it under the terms of the GNU General Public License as published by
968- * the Free Software Foundation; version 3.
969- *
970- * This program is distributed in the hope that it will be useful,
971- * but WITHOUT ANY WARRANTY; without even the implied warranty of
972- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
973- * GNU General Public License for more details.
974- *
975- * You should have received a copy of the GNU General Public License
976- * along with this program. If not, see <http://www.gnu.org/licenses/>.
977- */
978-
979-#include "SessionsModel.h"
980-#include "SessionsModelPrivate.h"
981-#include <QDebug>
982-namespace QLightDM
983-{
984-
985-SessionsModelPrivate::SessionsModelPrivate(SessionsModel* parent)
986- : testScenario("singleSession")
987- , q_ptr(parent)
988- , m_availableSessions(
989- {
990- {"ubuntu", "", "Ubuntu", ""},
991- {"ubuntu-2d", "", "Ubuntu 2D", ""},
992- {"gnome", "", "GNOME", ""},
993- {"gnome-classic", "", "GNOME Classic", ""},
994- {"gnome-flashback-compiz", "", "GNOME Flashback (Compiz)", ""},
995- {"gnome-flashback-metacity", "", "GNOME Flashback (Metacity)", ""},
996- {"gnome-wayland", "", "GNOME on Wayland", ""},
997- {"plasma", "", "Plasma", ""},
998- {"kde", "", "KDE" , ""},
999- {"xterm", "", "Recovery Console", ""},
1000- {"", "", "Unknown?", ""}
1001- })
1002-{
1003- numSessions = numAvailableSessions();
1004- resetEntries();
1005-}
1006-
1007-int SessionsModelPrivate::numAvailableSessions() const
1008-{
1009- return m_availableSessions.length();
1010-}
1011-
1012-void SessionsModelPrivate::resetEntries()
1013-{
1014- Q_Q(SessionsModel);
1015-
1016- q->beginResetModel();
1017- if (testScenario == "multipleSessions") {
1018- resetEntries_multipleSessions(numSessions);
1019- } else if (testScenario == "noSessions") {
1020- resetEntries_noSessions();
1021- } else {
1022- resetEntries_singleSession();
1023- }
1024- q->endResetModel();
1025-}
1026-
1027-void SessionsModelPrivate::resetEntries_multipleSessions(int numSessions)
1028-{
1029- sessionItems.clear();
1030- for (int i = 0; i < numSessions; i++) {
1031- sessionItems.append(m_availableSessions.value(i));
1032- }
1033-}
1034-
1035-void SessionsModelPrivate::resetEntries_noSessions()
1036-{
1037- sessionItems = {};
1038-}
1039-
1040-void SessionsModelPrivate::resetEntries_singleSession()
1041-{
1042- sessionItems = {{"ubuntu", "", "Ubuntu", ""}};
1043-}
1044-
1045-} // namespace QLightDM
1046
1047=== removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h'
1048--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h 2016-07-13 20:24:24 +0000
1049+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModelPrivate.h 1970-01-01 00:00:00 +0000
1050@@ -1,63 +0,0 @@
1051-/*
1052- * Copyright (C) 2015 Canonical, Ltd.
1053- *
1054- * This program is free software; you can redistribute it and/or modify
1055- * it under the terms of the GNU General Public License as published by
1056- * the Free Software Foundation; version 3.
1057- *
1058- * This program is distributed in the hope that it will be useful,
1059- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1060- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1061- * GNU General Public License for more details.
1062- *
1063- * You should have received a copy of the GNU General Public License
1064- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1065- *
1066- */
1067-
1068-#ifndef UNITY_MOCK_SESSIONSMODEL_PRIVATE_H
1069-#define UNITY_MOCK_SESSIONSMODEL_PRIVATE_H
1070-
1071-#include <QtCore/QList>
1072-#include <QtCore/QString>
1073-
1074-namespace QLightDM
1075-{
1076-class SessionsModel;
1077-
1078-class SessionItem
1079-{
1080-public:
1081- QString key;
1082- QString type; // unused
1083- QString name;
1084- QString comment; // unused
1085-};
1086-
1087-class SessionsModelPrivate
1088-{
1089-public:
1090- explicit SessionsModelPrivate(SessionsModel* parent=0);
1091- virtual ~SessionsModelPrivate() = default;
1092-
1093- int numAvailableSessions() const;
1094-
1095- QList<SessionItem> sessionItems;
1096- int numSessions;
1097- QString testScenario;
1098-
1099- void resetEntries();
1100-protected:
1101- SessionsModel* const q_ptr;
1102-
1103-private:
1104- const QList<SessionItem> m_availableSessions;
1105- void resetEntries_multipleSessions(int numSessions);
1106- void resetEntries_noSessions();
1107- void resetEntries_singleSession();
1108- Q_DECLARE_PUBLIC(SessionsModel)
1109-};
1110-
1111-} // namespace QLightDM
1112-
1113-#endif // UNITY_MOCK_SESSIONSMODEL_PRIVATE_H
1114
1115=== removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp'
1116--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp 2016-11-28 10:19:39 +0000
1117+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.cpp 1970-01-01 00:00:00 +0000
1118@@ -1,124 +0,0 @@
1119-/*
1120- * Copyright (C) 2014-2016 Canonical, Ltd.
1121- *
1122- * This program is free software; you can redistribute it and/or modify
1123- * it under the terms of the GNU General Public License as published by
1124- * the Free Software Foundation; version 3.
1125- *
1126- * This program is distributed in the hope that it will be useful,
1127- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1128- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1129- * GNU General Public License for more details.
1130- *
1131- * You should have received a copy of the GNU General Public License
1132- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1133- */
1134-
1135-#include "UsersModelPrivate.h"
1136-#include "UsersModel.h"
1137-
1138-#include <QDir>
1139-
1140-namespace QLightDM
1141-{
1142-
1143-UsersModelPrivate::UsersModelPrivate(UsersModel* parent)
1144- : mockMode("single")
1145- , q_ptr(parent)
1146-{
1147- char *envMockMode = getenv("LIBLIGHTDM_MOCK_MODE");
1148- if (envMockMode) {
1149- mockMode = envMockMode;
1150- }
1151- resetEntries();
1152-}
1153-
1154-void UsersModelPrivate::resetEntries()
1155-{
1156- Q_Q(UsersModel);
1157-
1158- q->beginResetModel();
1159-
1160- if (mockMode == "single") {
1161- resetEntries_single();
1162- } else if (mockMode == "single-passphrase") {
1163- resetEntries_singlePassphrase();
1164- } else if (mockMode == "single-pin") {
1165- resetEntries_singlePin();
1166- } else if (mockMode == "full") {
1167- resetEntries_full();
1168- }
1169-
1170- // Assign uids in a loop, just to avoid having to muck with them when
1171- // adding or removing test users.
1172- for (int i = 0; i < entries.size(); i++) {
1173- entries[i].uid = i + 1;
1174- }
1175-
1176- // Assign backgrounds
1177- QDir backgroundDir("/usr/share/backgrounds");
1178- QStringList backgrounds = backgroundDir.entryList(QDir::Files);
1179- if (!backgrounds.empty()) {
1180- for (int i = 0; i < entries.size(); i++) {
1181- if (entries[i].background.isNull()) {
1182- entries[i].background = backgroundDir.filePath(backgrounds[i % backgrounds.size()]);
1183- }
1184- }
1185- }
1186-
1187- q->endResetModel();
1188-}
1189-
1190-void UsersModelPrivate::resetEntries_single()
1191-{
1192- entries =
1193- {
1194- { "single", "Single User", 0, 0, false, false, "ubuntu", 0, 0 },
1195- };
1196-}
1197-
1198-void UsersModelPrivate::resetEntries_singlePassphrase()
1199-{
1200- entries =
1201- {
1202- { "single", "Single User", 0, 0, false, false, "ubuntu", 0, 0 },
1203- };
1204-}
1205-
1206-void UsersModelPrivate::resetEntries_singlePin()
1207-{
1208- entries =
1209- {
1210- { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0, 0 },
1211- };
1212-}
1213-
1214-void UsersModelPrivate::resetEntries_full()
1215-{
1216- entries =
1217- {
1218- { "has-password", "Has Password", 0, 0, false, false, "ubuntu", 0, 0 },
1219- { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0, 0 },
1220- { "different-prompt", "Different Prompt", 0, 0, false, false, "ubuntu", 0, 0 },
1221- { "no-password", "No Password", 0, 0, false, false, "ubuntu", 0, 0 },
1222- { "auth-error", "Auth Error", 0, 0, false, false, "ubuntu", 0, 0 },
1223- { "two-factor", "Two Factor", 0, 0, false, false, "ubuntu", 0, 0 },
1224- { "info-prompt", "Info Prompt", 0, 0, false, false, "ubuntu", 0, 0 },
1225- { "html-info-prompt", "HTML Info Prompt", 0, 0, false, false, "ubuntu", 0, 0 },
1226- { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, "ubuntu", 0, 0 },
1227- { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, "ubuntu", 0, 0 },
1228- { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, "ubuntu", 0, 0 },
1229- { "long-name", "Long name (far far too long to fit, seriously this would never fit on the screen, you will never see this part of the name)", 0, 0, false, false, "ubuntu", 0, 0 },
1230- { "color-background", "Color Background", "#E95420", 0, false, false, "ubuntu", 0, 0 },
1231- // white and black are a bit redundant, but useful for manually testing if UI is still readable
1232- { "white-background", "White Background", "#ffffff", 0, false, false, "ubuntu", 0, 0 },
1233- { "black-background", "Black Background", "#000000", 0, false, false, "ubuntu", 0, 0 },
1234- { "no-background", "No Background", "", 0, false, false, "ubuntu", 0, 0 },
1235- { "unicode", "가나다라마", 0, 0, false, false, "ubuntu", 0, 0 },
1236- { "no-response", "No Response", 0, 0, false, false, "ubuntu", 0, 0 },
1237- { "empty-name", "", 0, 0, false, false, "ubuntu", 0, 0 },
1238- { "active", "Active Account", 0, 0, true, false, "ubuntu", 0, 0 },
1239- };
1240-}
1241-
1242-} // namespace QLightDM
1243
1244=== removed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h'
1245--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h 2016-05-24 22:11:21 +0000
1246+++ tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModelPrivate.h 1970-01-01 00:00:00 +0000
1247@@ -1,64 +0,0 @@
1248-/*
1249- * Copyright (C) 2014-2016 Canonical, Ltd.
1250- *
1251- * This program is free software; you can redistribute it and/or modify
1252- * it under the terms of the GNU General Public License as published by
1253- * the Free Software Foundation; version 3.
1254- *
1255- * This program is distributed in the hope that it will be useful,
1256- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1257- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1258- * GNU General Public License for more details.
1259- *
1260- * You should have received a copy of the GNU General Public License
1261- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1262- */
1263-
1264-#ifndef UNITY_MOCK_USERSMODEL_PRIVATE_H
1265-#define UNITY_MOCK_USERSMODEL_PRIVATE_H
1266-
1267-#include <QtCore/QList>
1268-#include <QtCore/QString>
1269-
1270-namespace QLightDM
1271-{
1272-class UsersModel;
1273-
1274-class Entry
1275-{
1276-public:
1277- QString username;
1278- QString real_name;
1279- QString background;
1280- QString layouts;
1281- bool is_active;
1282- bool has_messages;
1283- QString session;
1284- QString infographic;
1285- uid_t uid;
1286-};
1287-
1288-class UsersModelPrivate
1289-{
1290-public:
1291- explicit UsersModelPrivate(UsersModel *parent = 0);
1292- virtual ~UsersModelPrivate() = default;
1293-
1294- QList<Entry> entries;
1295- QString mockMode;
1296-
1297- void resetEntries();
1298-protected:
1299- UsersModel * const q_ptr;
1300-
1301-private:
1302- void resetEntries_single();
1303- void resetEntries_singlePassphrase();
1304- void resetEntries_singlePin();
1305- void resetEntries_full();
1306- Q_DECLARE_PUBLIC(UsersModel)
1307-};
1308-
1309-}
1310-
1311-#endif // UNITY_MOCK_USERSMODEL_PRIVATE_H
1312
1313=== removed file 'tests/mocks/LightDM/IntegratedLightDM/plugin.cpp'
1314--- tests/mocks/LightDM/IntegratedLightDM/plugin.cpp 2016-06-16 17:23:24 +0000
1315+++ tests/mocks/LightDM/IntegratedLightDM/plugin.cpp 1970-01-01 00:00:00 +0000
1316@@ -1,79 +0,0 @@
1317-/*
1318- * Copyright (C) 2014, 2015 Canonical, Ltd.
1319- *
1320- * This program is free software; you can redistribute it and/or modify
1321- * it under the terms of the GNU General Public License as published by
1322- * the Free Software Foundation; version 3.
1323- *
1324- * This program is distributed in the hope that it will be useful,
1325- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1326- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1327- * GNU General Public License for more details.
1328- *
1329- * You should have received a copy of the GNU General Public License
1330- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1331- */
1332-
1333-#include "plugin.h"
1334-#include <DBusGreeter.h>
1335-#include <DBusGreeterList.h>
1336-#include "MockGreeter.h"
1337-#include "MockSessionsModel.h"
1338-#include "MockUsersModel.h"
1339-#include <QLightDM/SessionsModel>
1340-#include "ColorTheme.h"
1341-#include "UserMetrics.h"
1342-#include <QLightDM/UsersModel>
1343-
1344-#include <QAbstractItemModel>
1345-#include <QDBusConnection>
1346-#include <QtQml/qqml.h>
1347-
1348-static QObject *greeter_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
1349-{
1350- Q_UNUSED(engine)
1351- Q_UNUSED(scriptEngine)
1352-
1353- MockGreeter *greeter = new MockGreeter;
1354- new DBusGreeter(greeter, "/");
1355- new DBusGreeterList(greeter, "/list");
1356-
1357- return greeter;
1358-}
1359-
1360-static QObject *sessions_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
1361-{
1362- Q_UNUSED(engine)
1363- Q_UNUSED(scriptEngine)
1364- return new MockSessionsModel;
1365-}
1366-
1367-static QObject *users_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
1368-{
1369- Q_UNUSED(engine)
1370- Q_UNUSED(scriptEngine)
1371- return new MockUsersModel;
1372-}
1373-
1374-static QObject *infographic_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
1375-{
1376- Q_UNUSED(engine)
1377- Q_UNUSED(scriptEngine)
1378- return UserMetricsOutput::UserMetrics::getInstance();
1379-}
1380-
1381-void LightDMPlugin::registerTypes(const char *uri)
1382-{
1383- qmlRegisterType<QAbstractItemModel>();
1384- qmlRegisterType<UserMetricsOutput::ColorTheme>();
1385-
1386- Q_ASSERT(uri == QLatin1String("LightDM.IntegratedLightDM"));
1387- qRegisterMetaType<QLightDM::Greeter::MessageType>("QLightDM::Greeter::MessageType");
1388- qRegisterMetaType<QLightDM::Greeter::PromptType>("QLightDM::Greeter::PromptType");
1389- qmlRegisterSingletonType<MockGreeter>(uri, 0, 1, "Greeter", greeter_provider);
1390- qmlRegisterSingletonType<MockSessionsModel>(uri, 0, 1, "Sessions", sessions_provider);
1391- qmlRegisterUncreatableType<QLightDM::SessionsModel>(uri, 0, 1, "SessionRoles", "Type is not instantiable");
1392- qmlRegisterSingletonType<MockUsersModel>(uri, 0, 1, "Users", users_provider);
1393- qmlRegisterUncreatableType<QLightDM::UsersModel>(uri, 0, 1, "UserRoles", "Type is not instantiable");
1394- qmlRegisterSingletonType<UserMetricsOutput::UserMetrics>(uri, 0, 1, "Infographic", infographic_provider);
1395-}
1396
1397=== removed file 'tests/mocks/LightDM/IntegratedLightDM/plugin.h'
1398--- tests/mocks/LightDM/IntegratedLightDM/plugin.h 2015-09-25 13:01:00 +0000
1399+++ tests/mocks/LightDM/IntegratedLightDM/plugin.h 1970-01-01 00:00:00 +0000
1400@@ -1,32 +0,0 @@
1401-/*
1402- * Copyright (C) 2014, 2015 Canonical, Ltd.
1403- *
1404- * This program is free software; you can redistribute it and/or modify
1405- * it under the terms of the GNU General Public License as published by
1406- * the Free Software Foundation; version 3.
1407- *
1408- * This program is distributed in the hope that it will be useful,
1409- * but WITHOUT ANY WARRANTY; without even the implied warranty of
1410- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1411- * GNU General Public License for more details.
1412- *
1413- * You should have received a copy of the GNU General Public License
1414- * along with this program. If not, see <http://www.gnu.org/licenses/>.
1415- */
1416-
1417-#ifndef MOCK_LIGHTDM_PLUGIN_H
1418-#define MOCK_LIGHTDM_PLUGIN_H
1419-
1420-#include <QtQml/QQmlEngine>
1421-#include <QtQml/QQmlExtensionPlugin>
1422-
1423-class LightDMPlugin : public QQmlExtensionPlugin
1424-{
1425- Q_OBJECT
1426- Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
1427-
1428-public:
1429- void registerTypes(const char *uri) override;
1430-};
1431-
1432-#endif
1433
1434=== removed file 'tests/mocks/LightDM/IntegratedLightDM/qmldir'
1435--- tests/mocks/LightDM/IntegratedLightDM/qmldir 2015-09-25 13:01:00 +0000
1436+++ tests/mocks/LightDM/IntegratedLightDM/qmldir 1970-01-01 00:00:00 +0000
1437@@ -1,2 +0,0 @@
1438-module LightDM.IntegratedLightDM
1439-plugin MockLightDM-qml
1440
1441=== added directory 'tests/mocks/LightDMController'
1442=== added file 'tests/mocks/LightDMController/CMakeLists.txt'
1443--- tests/mocks/LightDMController/CMakeLists.txt 1970-01-01 00:00:00 +0000
1444+++ tests/mocks/LightDMController/CMakeLists.txt 2017-01-17 15:40:09 +0000
1445@@ -0,0 +1,15 @@
1446+add_library(LightDMController MODULE
1447+ plugin.cpp
1448+ )
1449+
1450+target_include_directories(LightDMController PUBLIC
1451+ ${CMAKE_SOURCE_DIR}/tests/mocks/liblightdm/
1452+ )
1453+
1454+target_link_libraries(LightDMController
1455+ MockLightDM
1456+ )
1457+
1458+qt5_use_modules(LightDMController Qml)
1459+
1460+add_unity8_mock(LightDMController 0.1 LightDMController TARGETS LightDMController)
1461
1462=== added file 'tests/mocks/LightDMController/plugin.cpp'
1463--- tests/mocks/LightDMController/plugin.cpp 1970-01-01 00:00:00 +0000
1464+++ tests/mocks/LightDMController/plugin.cpp 2017-01-17 15:40:09 +0000
1465@@ -0,0 +1,35 @@
1466+/*
1467+ * Copyright (C) 2017 Canonical, Ltd.
1468+ *
1469+ * This program is free software; you can redistribute it and/or modify
1470+ * it under the terms of the GNU General Public License as published by
1471+ * the Free Software Foundation; version 3.
1472+ *
1473+ * This program is distributed in the hope that it will be useful,
1474+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1475+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1476+ * GNU General Public License for more details.
1477+ *
1478+ * You should have received a copy of the GNU General Public License
1479+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1480+ */
1481+
1482+#include "plugin.h"
1483+
1484+#include "MockController.h"
1485+
1486+#include <QtQml/qqml.h>
1487+
1488+static QObject *mock_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
1489+{
1490+ Q_UNUSED(scriptEngine)
1491+ auto controller = QLightDM::MockController::instance();
1492+ engine->setObjectOwnership(controller, QQmlEngine::CppOwnership);
1493+ return controller;
1494+}
1495+
1496+void LightDMControllerPlugin::registerTypes(const char *uri)
1497+{
1498+ Q_ASSERT(uri == QLatin1String("LightDMController"));
1499+ qmlRegisterSingletonType<QLightDM::MockController>(uri, 0, 1, "LightDMController", mock_provider);
1500+}
1501
1502=== added file 'tests/mocks/LightDMController/plugin.h'
1503--- tests/mocks/LightDMController/plugin.h 1970-01-01 00:00:00 +0000
1504+++ tests/mocks/LightDMController/plugin.h 2017-01-17 15:40:09 +0000
1505@@ -0,0 +1,29 @@
1506+/*
1507+ * Copyright (C) 2016 Canonical, Ltd.
1508+ *
1509+ * This program is free software; you can redistribute it and/or modify
1510+ * it under the terms of the GNU General Public License as published by
1511+ * the Free Software Foundation; version 3.
1512+ *
1513+ * This program is distributed in the hope that it will be useful,
1514+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1515+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1516+ * GNU General Public License for more details.
1517+ *
1518+ * You should have received a copy of the GNU General Public License
1519+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1520+ */
1521+
1522+#pragma once
1523+
1524+#include <QQmlEngine>
1525+#include <QQmlExtensionPlugin>
1526+
1527+class LightDMControllerPlugin : public QQmlExtensionPlugin
1528+{
1529+ Q_OBJECT
1530+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
1531+
1532+public:
1533+ void registerTypes(const char *uri) override;
1534+};
1535
1536=== added file 'tests/mocks/LightDMController/qmldir'
1537--- tests/mocks/LightDMController/qmldir 1970-01-01 00:00:00 +0000
1538+++ tests/mocks/LightDMController/qmldir 2017-01-17 15:40:09 +0000
1539@@ -0,0 +1,2 @@
1540+module LightDMController
1541+plugin LightDMController
1542
1543=== renamed directory 'tests/mocks/LightDM/IntegratedLightDM/liblightdm' => 'tests/mocks/liblightdm'
1544=== modified file 'tests/mocks/liblightdm/CMakeLists.txt'
1545--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt 2016-12-06 20:16:56 +0000
1546+++ tests/mocks/liblightdm/CMakeLists.txt 2017-01-17 15:40:09 +0000
1547@@ -1,21 +1,18 @@
1548-set(LibLightDM_SOURCES
1549- Greeter.cpp
1550- SessionsModel.cpp
1551- UsersModel.cpp
1552- GreeterPrivate.cpp
1553- SessionsModelPrivate.cpp
1554- UsersModelPrivate.cpp
1555- ${CMAKE_SOURCE_DIR}/plugins/Utils/qvariantlistmodel.cpp
1556+set(MockLightDM_SOURCES
1557+ MockController.cpp
1558+ MockGreeter.cpp
1559+ MockSessionsModel.cpp
1560+ MockUsersModel.cpp
1561 )
1562
1563-add_library(MockLightDM SHARED ${LibLightDM_SOURCES})
1564+add_library(MockLightDM SHARED ${MockLightDM_SOURCES})
1565
1566-qt5_use_modules(MockLightDM Gui)
1567+qt5_use_modules(MockLightDM DBus Gui)
1568
1569 set_target_properties(MockLightDM PROPERTIES
1570 OUTPUT_NAME lightdm-qt5-3
1571 SOVERSION 0)
1572
1573 install(TARGETS MockLightDM
1574- DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/IntegratedLightDM/liblightdm
1575+ DESTINATION ${SHELL_INSTALL_QML}/mocks/liblightdm
1576 )
1577
1578=== added file 'tests/mocks/liblightdm/MockController.cpp'
1579--- tests/mocks/liblightdm/MockController.cpp 1970-01-01 00:00:00 +0000
1580+++ tests/mocks/liblightdm/MockController.cpp 2017-01-17 15:40:09 +0000
1581@@ -0,0 +1,124 @@
1582+/*
1583+ * Copyright (C) 2016 Canonical, Ltd.
1584+ *
1585+ * This program is free software; you can redistribute it and/or modify
1586+ * it under the terms of the GNU General Public License as published by
1587+ * the Free Software Foundation; version 3.
1588+ *
1589+ * This program is distributed in the hope that it will be useful,
1590+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1591+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1592+ * GNU General Public License for more details.
1593+ *
1594+ * You should have received a copy of the GNU General Public License
1595+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1596+ */
1597+
1598+#include "MockController.h"
1599+
1600+static QLightDM::MockController *m_instance = nullptr;
1601+
1602+namespace QLightDM
1603+{
1604+
1605+MockController::MockController(QObject *parent)
1606+ : QObject(parent)
1607+ , m_fullSessions(
1608+ {
1609+ {"ubuntu", "Ubuntu"},
1610+ {"ubuntu-2d", "Ubuntu 2D"},
1611+ {"gnome", "GNOME"},
1612+ {"gnome-classic", "GNOME Classic"},
1613+ {"gnome-flashback-compiz", "GNOME Flashback (Compiz)"},
1614+ {"gnome-flashback-metacity", "GNOME Flashback (Metacity)"},
1615+ {"gnome-wayland", "GNOME on Wayland"},
1616+ {"plasma", "Plasma"},
1617+ {"kde", "KDE" },
1618+ {"xterm", "Recovery Console"},
1619+ {"", "Unknown?"}
1620+ })
1621+{
1622+ m_userMode = qgetenv("LIBLIGHTDM_MOCK_MODE");
1623+ if (m_userMode.isEmpty()) {
1624+ m_userMode = "full";
1625+ }
1626+ m_sessionMode = "full";
1627+ m_numSessions = numFullSessions();
1628+}
1629+
1630+MockController::~MockController()
1631+{
1632+ m_instance = nullptr;
1633+}
1634+
1635+MockController *MockController::instance()
1636+{
1637+ if (!m_instance) {
1638+ m_instance = new MockController;
1639+ }
1640+ return m_instance;
1641+}
1642+
1643+QString MockController::selectUserHint() const
1644+{
1645+ return m_selectUserHint;
1646+}
1647+
1648+void MockController::setSelectUserHint(const QString &selectUserHint)
1649+{
1650+ if (m_selectUserHint != selectUserHint) {
1651+ m_selectUserHint = selectUserHint;
1652+ Q_EMIT selectUserHintChanged();
1653+ }
1654+}
1655+
1656+QString MockController::userMode() const
1657+{
1658+ return m_userMode;
1659+}
1660+
1661+void MockController::setUserMode(const QString &userMode)
1662+{
1663+ if (m_userMode != userMode) {
1664+ m_userMode = userMode;
1665+ Q_EMIT userModeChanged();
1666+ }
1667+}
1668+
1669+QString MockController::sessionMode() const
1670+{
1671+ return m_sessionMode;
1672+}
1673+
1674+void MockController::setSessionMode(const QString &sessionMode)
1675+{
1676+ if (m_sessionMode != sessionMode) {
1677+ m_sessionMode = sessionMode;
1678+ Q_EMIT sessionModeChanged();
1679+ }
1680+}
1681+
1682+const QList<MockController::SessionItem> &MockController::fullSessionItems() const
1683+{
1684+ return m_fullSessions;
1685+}
1686+
1687+int MockController::numFullSessions() const
1688+{
1689+ return m_fullSessions.size();
1690+}
1691+
1692+int MockController::numSessions() const
1693+{
1694+ return m_numSessions;
1695+}
1696+
1697+void MockController::setNumSessions(int numSessions)
1698+{
1699+ if (m_numSessions != numSessions) {
1700+ m_numSessions = numSessions;
1701+ Q_EMIT numSessionsChanged();
1702+ }
1703+}
1704+
1705+}
1706
1707=== added file 'tests/mocks/liblightdm/MockController.h'
1708--- tests/mocks/liblightdm/MockController.h 1970-01-01 00:00:00 +0000
1709+++ tests/mocks/liblightdm/MockController.h 2017-01-17 15:40:09 +0000
1710@@ -0,0 +1,80 @@
1711+/*
1712+ * Copyright (C) 2016 Canonical, Ltd.
1713+ *
1714+ * This program is free software; you can redistribute it and/or modify
1715+ * it under the terms of the GNU General Public License as published by
1716+ * the Free Software Foundation; version 3.
1717+ *
1718+ * This program is distributed in the hope that it will be useful,
1719+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1720+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1721+ * GNU General Public License for more details.
1722+ *
1723+ * You should have received a copy of the GNU General Public License
1724+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1725+ */
1726+
1727+#pragma once
1728+
1729+#include <QObject>
1730+#include <QString>
1731+
1732+
1733+namespace QLightDM
1734+{
1735+class Q_DECL_EXPORT MockController : public QObject
1736+{
1737+ Q_OBJECT
1738+
1739+ Q_PROPERTY(QString selectUserHint READ selectUserHint WRITE setSelectUserHint NOTIFY selectUserHintChanged)
1740+
1741+ // single, single-pin, single-passphrase, full
1742+ Q_PROPERTY(QString userMode READ userMode WRITE setUserMode NOTIFY userModeChanged)
1743+
1744+ // single, none, full
1745+ Q_PROPERTY(QString sessionMode READ sessionMode WRITE setSessionMode NOTIFY sessionModeChanged)
1746+
1747+ Q_PROPERTY(int numAvailableSessions READ numFullSessions CONSTANT)
1748+ Q_PROPERTY(int numSessions READ numSessions WRITE setNumSessions NOTIFY numSessionsChanged)
1749+
1750+public:
1751+ static MockController *instance();
1752+ virtual ~MockController();
1753+
1754+ QString selectUserHint() const;
1755+ void setSelectUserHint(const QString &selectUserHint);
1756+
1757+ QString userMode() const;
1758+ void setUserMode(const QString &userMode);
1759+
1760+ QString sessionMode() const;
1761+ void setSessionMode(const QString &sessionMode);
1762+
1763+ class SessionItem
1764+ {
1765+ public:
1766+ QString key;
1767+ QString name;
1768+ };
1769+ int numFullSessions() const;
1770+ const QList<SessionItem> &fullSessionItems() const;
1771+
1772+ int numSessions() const;
1773+ void setNumSessions(int numSessions);
1774+
1775+Q_SIGNALS:
1776+ void selectUserHintChanged();
1777+ void userModeChanged();
1778+ void sessionModeChanged();
1779+ void numSessionsChanged();
1780+
1781+private:
1782+ explicit MockController(QObject* parent=0);
1783+
1784+ QString m_selectUserHint;
1785+ QString m_userMode;
1786+ QString m_sessionMode;
1787+ QList<SessionItem> m_fullSessions;
1788+ int m_numSessions;
1789+};
1790+}
1791
1792=== renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp' => 'tests/mocks/liblightdm/MockGreeter.cpp'
1793--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.cpp 2016-12-23 11:04:53 +0000
1794+++ tests/mocks/liblightdm/MockGreeter.cpp 2017-01-17 15:40:09 +0000
1795@@ -1,5 +1,5 @@
1796 /*
1797- * Copyright (C) 2014 Canonical, Ltd.
1798+ * Copyright (C) 2014-2016 Canonical, Ltd.
1799 *
1800 * This program is free software; you can redistribute it and/or modify
1801 * it under the terms of the GNU General Public License as published by
1802@@ -14,27 +14,38 @@
1803 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1804 */
1805
1806-#include "Greeter.h"
1807-#include "GreeterPrivate.h"
1808-#include <QtCore/QCoreApplication>
1809+#include "MockController.h"
1810+#include "MockGreeter.h"
1811+#include <QDBusInterface>
1812+#include <QDBusPendingCall>
1813 #include <QTimer>
1814
1815 namespace QLightDM
1816 {
1817
1818+class GreeterPrivate
1819+{
1820+public:
1821+ bool authenticated = false;
1822+ QString authenticationUser;
1823+ bool twoFactorDone = false;
1824+};
1825+
1826 Greeter::Greeter(QObject *parent)
1827- : QObject(parent),
1828- d_ptr(new GreeterPrivate(this))
1829+ : QObject(parent)
1830+ , d_ptr(new GreeterPrivate)
1831 {
1832 }
1833
1834 Greeter::~Greeter()
1835 {
1836+ delete d_ptr;
1837 }
1838
1839 QString Greeter::authenticationUser() const
1840 {
1841 Q_D(const Greeter);
1842+
1843 return d->authenticationUser;
1844 }
1845
1846@@ -71,14 +82,7 @@
1847
1848 QString Greeter::selectUserHint() const
1849 {
1850- Q_D(const Greeter);
1851- return d->selectUserHint;
1852-}
1853-
1854-void Greeter::setSelectUserHint(const QString &selectUserHint)
1855-{
1856- Q_D(Greeter);
1857- d->selectUserHint = selectUserHint;
1858+ return MockController::instance()->selectUserHint();
1859 }
1860
1861 bool Greeter::selectGuestHint() const
1862@@ -114,6 +118,7 @@
1863 bool Greeter::isAuthenticated() const
1864 {
1865 Q_D(const Greeter);
1866+
1867 return d->authenticated;
1868 }
1869
1870@@ -129,13 +134,42 @@
1871 d->authenticated = false;
1872 d->authenticationUser = username;
1873 d->twoFactorDone = false;
1874- QTimer::singleShot(0, this, &Greeter::delayedAuthentication);
1875+ QTimer::singleShot(0, this, &Greeter::handleAuthenticate);
1876 }
1877
1878-void Greeter::delayedAuthentication()
1879+void Greeter::handleAuthenticate()
1880 {
1881 Q_D(Greeter);
1882- d->handleAuthenticate();
1883+
1884+ // Send out any messages we need to
1885+ if (d->authenticationUser == "info-prompt")
1886+ Q_EMIT showMessage("Welcome to Unity Greeter", Greeter::MessageTypeInfo);
1887+ else if (d->authenticationUser == "wide-info-prompt")
1888+ Q_EMIT showMessage("Welcome to Unity Greeter, the greeteriest greeter that ever did appear in these fine lands", Greeter::MessageTypeInfo);
1889+ else if (d->authenticationUser == "html-info-prompt")
1890+ Q_EMIT showMessage("<b>&</b>", Greeter::MessageTypeInfo);
1891+ else if (d->authenticationUser == "long-info-prompt")
1892+ Q_EMIT showMessage("Welcome to Unity Greeter\n\nWe like to annoy you with super ridiculously long messages.\nLike this one\n\nThis is the last line of a multiple line message.", Greeter::MessageTypeInfo);
1893+ else if (d->authenticationUser == "multi-info-prompt") {
1894+ Q_EMIT showMessage("Welcome to Unity Greeter", Greeter::MessageTypeInfo);
1895+ Q_EMIT showMessage("This is an error", Greeter::MessageTypeError);
1896+ Q_EMIT showMessage("You should have seen three messages", Greeter::MessageTypeInfo);
1897+ }
1898+
1899+ // OK, now actually do the prompt
1900+ if (d->authenticationUser == "no-password") {
1901+ d->authenticated = true;
1902+ Q_EMIT authenticationComplete();
1903+ } else if (d->authenticationUser == "has-pin"){
1904+ Q_EMIT showPrompt("Password: ", Greeter::PromptTypeSecret);
1905+ } else if (d->authenticationUser == "auth-error") {
1906+ d->authenticated = false;
1907+ Q_EMIT authenticationComplete();
1908+ } else if (d->authenticationUser == "different-prompt") {
1909+ Q_EMIT showPrompt("Secret word: ", Greeter::PromptTypeSecret);
1910+ } else {
1911+ Q_EMIT showPrompt("Password: ", Greeter::PromptTypeSecret);
1912+ }
1913 }
1914
1915 void Greeter::authenticateAsGuest()
1916@@ -161,6 +195,16 @@
1917 bool Greeter::startSessionSync(const QString &session)
1918 {
1919 Q_UNUSED(session)
1920+
1921+ // Send a request to hide the greeter. This is normally done by logind,
1922+ // but when testing, we don't want the bother of mocking that out. Instead,
1923+ // just send the request directly ourselves.
1924+ QDBusInterface iface("com.canonical.UnityGreeter",
1925+ "/",
1926+ "com.canonical.UnityGreeter",
1927+ QDBusConnection::sessionBus());
1928+ iface.asyncCall("HideGreeter");
1929+
1930 return true;
1931 }
1932
1933@@ -168,7 +212,30 @@
1934 {
1935 Q_D(Greeter);
1936
1937- d->handleRespond(response);
1938+ if (d->authenticationUser == "no-response")
1939+ return;
1940+ else if (d->authenticationUser == "two-factor") {
1941+ if (!d->twoFactorDone) {
1942+ if (response == "password") {
1943+ d->twoFactorDone = true;
1944+ Q_EMIT showPrompt("otp", Greeter::PromptTypeQuestion);
1945+ } else {
1946+ d->authenticated = false;
1947+ sendAuthenticationComplete();
1948+ }
1949+ } else {
1950+ d->authenticated = (response == "otp");
1951+ sendAuthenticationComplete();
1952+ }
1953+ return;
1954+ }
1955+
1956+ if (d->authenticationUser == "has-pin") {
1957+ d->authenticated = (response == "1234");
1958+ } else {
1959+ d->authenticated = (response == "password");
1960+ }
1961+ sendAuthenticationComplete();
1962 }
1963
1964 void Greeter::sendAuthenticationComplete()
1965@@ -181,21 +248,4 @@
1966 }
1967 }
1968
1969-QString Greeter::mockMode() const
1970-{
1971- Q_D(const Greeter);
1972- return d->mockMode;
1973-}
1974-
1975-
1976-void Greeter::setMockMode(QString mockMode)
1977-{
1978- Q_D(Greeter);
1979-
1980- if (d->mockMode != mockMode) {
1981- d->mockMode = mockMode;
1982- Q_EMIT mockModeChanged(mockMode);
1983- }
1984-}
1985-
1986 }
1987
1988=== renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.h' => 'tests/mocks/liblightdm/MockGreeter.h'
1989--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/Greeter.h 2016-12-23 11:04:53 +0000
1990+++ tests/mocks/liblightdm/MockGreeter.h 2017-01-17 15:40:09 +0000
1991@@ -1,5 +1,5 @@
1992 /*
1993- * Copyright (C) 2013 Canonical, Ltd.
1994+ * Copyright (C) 2013-2016 Canonical, Ltd.
1995 * Copyright (C) 2010-2011 David Edmundson.
1996 * Copyright (C) 2010-2011 Robert Ancell
1997 *
1998@@ -18,16 +18,14 @@
1999 * Author: David Edmundson <kde@davidedmundson.co.uk>
2000 */
2001
2002-#ifndef UNITY_MOCK_GREETER_H
2003-#define UNITY_MOCK_GREETER_H
2004-
2005-#include <QtCore/QObject>
2006-#include <QtCore/QVariant>
2007-
2008+#pragma once
2009+
2010+#include <QObject>
2011+#include <QVariant>
2012
2013 namespace QLightDM
2014 {
2015- class GreeterPrivate;
2016+class GreeterPrivate;
2017
2018 class Q_DECL_EXPORT Greeter : public QObject
2019 {
2020@@ -42,9 +40,6 @@
2021 Q_PROPERTY(QString hostname READ hostname CONSTANT)
2022 Q_PROPERTY(bool hasGuestAccount READ hasGuestAccountHint CONSTANT)
2023
2024- //Mock-only API for testing purposes
2025- Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
2026-
2027 public:
2028 enum PromptType {
2029 PromptTypeQuestion,
2030@@ -68,7 +63,6 @@
2031 bool showRemoteLoginHint() const;
2032 bool hasGuestAccountHint() const;
2033 QString selectUserHint() const;
2034- void setSelectUserHint(const QString &selectUserHint); // only in mock
2035 bool selectGuestHint() const;
2036 QString autologinUserHint() const;
2037 bool autologinGuestHint() const;
2038@@ -79,9 +73,6 @@
2039 QString authenticationUser() const;
2040 QString hostname() const;
2041
2042- QString mockMode() const;
2043- void setMockMode(QString mockMode);
2044-
2045 public Q_SLOTS:
2046 bool connectSync();
2047 void authenticate(const QString &username=QString());
2048@@ -98,18 +89,14 @@
2049 void showPrompt(QString text, QLightDM::Greeter::PromptType type);
2050 void authenticationComplete();
2051 void autologinTimerExpired();
2052- void mockModeChanged(QString mode);
2053-
2054-protected:
2055- void sendAuthenticationComplete();
2056
2057 private Q_SLOTS:
2058- void delayedAuthentication();
2059+ void handleAuthenticate();
2060
2061 private:
2062+ void sendAuthenticationComplete();
2063+
2064 GreeterPrivate *d_ptr;
2065 Q_DECLARE_PRIVATE(Greeter)
2066 };
2067 }
2068-
2069-#endif // UNITY_MOCK_GREETER_H
2070
2071=== renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp' => 'tests/mocks/liblightdm/MockSessionsModel.cpp'
2072--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.cpp 2016-12-23 11:04:53 +0000
2073+++ tests/mocks/liblightdm/MockSessionsModel.cpp 2017-01-17 15:40:09 +0000
2074@@ -1,5 +1,5 @@
2075 /*
2076- * Copyright (C) 2015 Canonical, Ltd.
2077+ * Copyright (C) 2015-2016 Canonical, Ltd.
2078 *
2079 * This program is free software; you can redistribute it and/or modify
2080 * it under the terms of the GNU General Public License as published by
2081@@ -21,21 +21,35 @@
2082 // set our compatibility to Qt4 here too.
2083 #define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0)
2084
2085-#include "SessionsModel.h"
2086-#include "SessionsModelPrivate.h"
2087-#include <QtCore/QDir>
2088-#include <QtCore/QString>
2089+#include "MockController.h"
2090+#include "MockSessionsModel.h"
2091
2092 namespace QLightDM
2093 {
2094
2095-SessionsModel::SessionsModel(QObject* parent) :
2096- QAbstractListModel(parent),
2097- d_ptr(new SessionsModelPrivate(this))
2098-{
2099- m_roleNames = QAbstractListModel::roleNames();
2100- m_roleNames[KeyRole] = "key";
2101- m_roleNames[TypeRole] = "type";
2102+class SessionsModelPrivate
2103+{
2104+public:
2105+ QHash<int, QByteArray> roleNames;
2106+ QList<MockController::SessionItem> sessionItems;
2107+};
2108+
2109+SessionsModel::SessionsModel(QObject* parent)
2110+ : QAbstractListModel(parent)
2111+ , d_ptr(new SessionsModelPrivate)
2112+{
2113+ Q_D(SessionsModel);
2114+
2115+ d->roleNames = QAbstractListModel::roleNames();
2116+ d->roleNames[KeyRole] = "key";
2117+ d->roleNames[TypeRole] = "type";
2118+ setRoleNames(d->roleNames);
2119+
2120+ connect(MockController::instance(), &MockController::sessionModeChanged,
2121+ this, &SessionsModel::resetEntries);
2122+ connect(MockController::instance(), &MockController::numSessionsChanged,
2123+ this, &SessionsModel::resetEntries);
2124+ resetEntries();
2125 }
2126
2127 SessionsModel::~SessionsModel()
2128@@ -65,7 +79,9 @@
2129
2130 QHash<int, QByteArray> SessionsModel::roleNames() const
2131 {
2132- return m_roleNames;
2133+ Q_D(const SessionsModel);
2134+
2135+ return d->roleNames;
2136 }
2137
2138 int SessionsModel::rowCount(const QModelIndex& parent) const
2139@@ -79,42 +95,24 @@
2140 }
2141 }
2142
2143-int SessionsModel::numSessions() const
2144-{
2145- Q_D(const SessionsModel);
2146- return d->numSessions;
2147-}
2148-
2149-int SessionsModel::numAvailableSessions() const
2150-{
2151- Q_D(const SessionsModel);
2152- return d->numAvailableSessions();
2153-}
2154-
2155-QString SessionsModel::testScenario() const
2156-{
2157- Q_D(const SessionsModel);
2158- return d->testScenario;
2159-}
2160-
2161-void SessionsModel::setNumSessions(int numSessions)
2162-{
2163- Q_D(SessionsModel);
2164-
2165- if (d->numSessions != numSessions) {
2166- d->numSessions = numSessions;
2167- d->resetEntries();
2168- }
2169-}
2170-
2171-void SessionsModel::setTestScenario(QString testScenario)
2172-{
2173- Q_D(SessionsModel);
2174-
2175- if (d->testScenario != testScenario) {
2176- d->testScenario = testScenario;
2177- d->resetEntries();
2178- }
2179+void SessionsModel::resetEntries()
2180+{
2181+ Q_D(SessionsModel);
2182+
2183+ beginResetModel();
2184+
2185+ QString sessionMode = MockController::instance()->sessionMode();
2186+
2187+ if (sessionMode == "full") {
2188+ d->sessionItems = MockController::instance()->fullSessionItems();
2189+ d->sessionItems = d->sessionItems.mid(0, MockController::instance()->numSessions());
2190+ } else if (sessionMode == "single") {
2191+ d->sessionItems = {MockController::instance()->fullSessionItems()[0]};
2192+ } else {
2193+ d->sessionItems = {};
2194+ }
2195+
2196+ endResetModel();
2197 }
2198
2199 } // namespace QLightDM
2200
2201=== renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h' => 'tests/mocks/liblightdm/MockSessionsModel.h'
2202--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/SessionsModel.h 2016-12-23 11:04:53 +0000
2203+++ tests/mocks/liblightdm/MockSessionsModel.h 2017-01-17 15:40:09 +0000
2204@@ -1,5 +1,5 @@
2205 /*
2206- * Copyright (C) 2015 Canonical, Ltd.
2207+ * Copyright (C) 2015-2016 Canonical, Ltd.
2208 *
2209 * This program is free software; you can redistribute it and/or modify
2210 * it under the terms of the GNU General Public License as published by
2211@@ -15,11 +15,12 @@
2212 *
2213 */
2214
2215-#ifndef UNITY_MOCK_SESSIONSMODEL_H
2216-#define UNITY_MOCK_SESSIONSMODEL_H
2217+#pragma once
2218
2219-#include <QtCore/QAbstractListModel>
2220-#include <QtCore/QString>
2221+#include <QAbstractListModel>
2222+#include <QByteArray>
2223+#include <QHash>
2224+#include <QString>
2225
2226 namespace QLightDM
2227 {
2228@@ -30,7 +31,6 @@
2229 Q_OBJECT
2230
2231 public:
2232-
2233 enum SessionModelRoles {
2234 //name is exposed as Qt::DisplayRole
2235 //comment is exposed as Qt::TooltipRole
2236@@ -54,19 +54,11 @@
2237 int rowCount(const QModelIndex& parent) const override;
2238 QVariant data(const QModelIndex& index, int role) const override;
2239
2240- int numSessions() const;
2241- int numAvailableSessions() const;
2242- QString testScenario() const;
2243- void setNumSessions(int numSessions);
2244- void setTestScenario(QString testScenario);
2245-
2246- protected:
2247- SessionsModelPrivate* const d_ptr;
2248+ private Q_SLOTS:
2249+ void resetEntries();
2250
2251 private:
2252- QHash<int, QByteArray> m_roleNames;
2253+ SessionsModelPrivate *d_ptr;
2254 Q_DECLARE_PRIVATE(SessionsModel)
2255 };
2256 }
2257-
2258-#endif // UNITY_MOCK_SESSIONSMODEL_H
2259
2260=== renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp' => 'tests/mocks/liblightdm/MockUsersModel.cpp'
2261--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.cpp 2016-12-23 11:04:53 +0000
2262+++ tests/mocks/liblightdm/MockUsersModel.cpp 2017-01-17 15:40:09 +0000
2263@@ -21,18 +21,36 @@
2264 // set our compatibility to Qt4 here too.
2265 #define QT_DISABLE_DEPRECATED_BEFORE QT_VERSION_CHECK(4, 0, 0)
2266
2267-#include "UsersModel.h"
2268-#include "UsersModelPrivate.h"
2269-#include <QtCore/QDir>
2270-#include <QtCore/QString>
2271-#include <QtGui/QIcon>
2272+#include "MockController.h"
2273+#include "MockUsersModel.h"
2274+#include <QDir>
2275+#include <QIcon>
2276
2277 namespace QLightDM
2278 {
2279
2280-UsersModel::UsersModel(QObject *parent) :
2281- QAbstractListModel(parent),
2282- d_ptr(new UsersModelPrivate(this))
2283+class Entry
2284+{
2285+public:
2286+ QString username;
2287+ QString real_name;
2288+ QString background;
2289+ QString layouts;
2290+ bool is_active;
2291+ bool has_messages;
2292+ QString session;
2293+ uid_t uid;
2294+};
2295+
2296+class UsersModelPrivate
2297+{
2298+public:
2299+ QList<Entry> entries;
2300+};
2301+
2302+UsersModel::UsersModel(QObject *parent)
2303+ : QAbstractListModel(parent)
2304+ , d_ptr(new UsersModelPrivate)
2305 {
2306 // Extend roleNames (we want to keep the "display" role)
2307 QHash<int, QByteArray> roles = roleNames();
2308@@ -46,6 +64,10 @@
2309 roles[ImagePathRole] = "imagePath";
2310 roles[UidRole] = "uid";
2311 setRoleNames(roles);
2312+
2313+ connect(MockController::instance(), &MockController::userModeChanged,
2314+ this, &UsersModel::resetEntries);
2315+ resetEntries();
2316 }
2317
2318 UsersModel::~UsersModel()
2319@@ -101,21 +123,64 @@
2320 }
2321 }
2322
2323-QString UsersModel::mockMode() const
2324-{
2325- Q_D(const UsersModel);
2326- return d->mockMode;
2327-}
2328-
2329-void UsersModel::setMockMode(QString mockMode)
2330+void UsersModel::resetEntries()
2331 {
2332 Q_D(UsersModel);
2333
2334- if (d->mockMode != mockMode) {
2335- d->mockMode = mockMode;
2336- Q_EMIT mockModeChanged(mockMode);
2337- d->resetEntries();
2338- }
2339+ beginResetModel();
2340+
2341+ QString userMode = MockController::instance()->userMode();
2342+
2343+ if (userMode == "single") {
2344+ d->entries = {{"no-password", "No Password", "", 0, false, false, "ubuntu", 0}};
2345+ } else if (userMode == "single-passphrase") {
2346+ d->entries = {{"has-password", "Has Password", "", 0, false, false, "ubuntu", 0}};
2347+ } else if (userMode == "single-pin") {
2348+ d->entries = {{"has-pin", "Has PIN", "", 0, false, false, "ubuntu", 0}};
2349+ } else if (userMode == "full") {
2350+ d->entries = {
2351+ { "has-password", "Has Password", 0, 0, false, false, "ubuntu", 0 },
2352+ { "has-pin", "Has PIN", 0, 0, false, false, "ubuntu", 0 },
2353+ { "different-prompt", "Different Prompt", 0, 0, false, false, "ubuntu", 0 },
2354+ { "no-password", "No Password", 0, 0, false, false, "ubuntu", 0 },
2355+ { "auth-error", "Auth Error", 0, 0, false, false, "ubuntu", 0 },
2356+ { "two-factor", "Two Factor", 0, 0, false, false, "ubuntu", 0 },
2357+ { "info-prompt", "Info Prompt", 0, 0, false, false, "ubuntu", 0 },
2358+ { "html-info-prompt", "HTML Info Prompt", 0, 0, false, false, "ubuntu", 0 },
2359+ { "long-info-prompt", "Long Info Prompt", 0, 0, false, false, "ubuntu", 0 },
2360+ { "wide-info-prompt", "Wide Info Prompt", 0, 0, false, false, "ubuntu", 0 },
2361+ { "multi-info-prompt", "Multi Info Prompt", 0, 0, false, false, "ubuntu", 0 },
2362+ { "long-name", "Long name (far far too long to fit, seriously this would never fit on the screen, you will never see this part of the name)", 0, 0, false, false, "ubuntu", 0 },
2363+ { "color-background", "Color Background", "#E95420", 0, false, false, "ubuntu", 0 },
2364+ // white and black are a bit redundant, but useful for manually testing if UI is still readable
2365+ { "white-background", "White Background", "#ffffff", 0, false, false, "ubuntu", 0 },
2366+ { "black-background", "Black Background", "#000000", 0, false, false, "ubuntu", 0 },
2367+ { "no-background", "No Background", "", 0, false, false, "ubuntu", 0 },
2368+ { "unicode", "가나다라마", 0, 0, false, false, "ubuntu", 0 },
2369+ { "no-response", "No Response", 0, 0, false, false, "ubuntu", 0 },
2370+ { "empty-name", "", 0, 0, false, false, "ubuntu", 0 },
2371+ { "active", "Active Account", 0, 0, true, false, "ubuntu", 0 },
2372+ };
2373+ }
2374+
2375+ // Assign uids in a loop, just to avoid having to muck with them when
2376+ // adding or removing test users.
2377+ for (int i = 0; i < d->entries.size(); i++) {
2378+ d->entries[i].uid = i + 1;
2379+ }
2380+
2381+ // Assign backgrounds
2382+ QDir backgroundDir("/usr/share/backgrounds");
2383+ QStringList backgrounds = backgroundDir.entryList(QDir::Files);
2384+ if (!backgrounds.empty()) {
2385+ for (int i = 0; i < d->entries.size(); i++) {
2386+ if (d->entries[i].background.isNull()) {
2387+ d->entries[i].background = backgroundDir.filePath(backgrounds[i % backgrounds.size()]);
2388+ }
2389+ }
2390+ }
2391+
2392+ endResetModel();
2393 }
2394
2395 }
2396
2397=== renamed file 'tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.h' => 'tests/mocks/liblightdm/MockUsersModel.h'
2398--- tests/mocks/LightDM/IntegratedLightDM/liblightdm/UsersModel.h 2016-12-23 11:04:53 +0000
2399+++ tests/mocks/liblightdm/MockUsersModel.h 2017-01-17 15:40:09 +0000
2400@@ -1,5 +1,5 @@
2401 /*
2402- * Copyright (C) 2013-2014 Canonical, Ltd.
2403+ * Copyright (C) 2013-2016 Canonical, Ltd.
2404 * Copyright (C) 2010-2011 David Edmundson.
2405 *
2406 * This program is free software; you can redistribute it and/or modify
2407@@ -15,13 +15,11 @@
2408 * along with this program. If not, see <http://www.gnu.org/licenses/>.
2409 */
2410
2411-#ifndef UNITY_MOCK_USERSMODEL_H
2412-#define UNITY_MOCK_USERSMODEL_H
2413+#pragma once
2414
2415-#include <QtCore/QString>
2416-#include <QtCore/QSharedDataPointer>
2417 #include <QAbstractListModel>
2418-
2419+#include <QList>
2420+#include <QString>
2421
2422 namespace QLightDM
2423 {
2424@@ -31,12 +29,6 @@
2425 {
2426 Q_OBJECT
2427
2428- //Mock-only API for testing purposes
2429- Q_PROPERTY(QString mockMode READ mockMode WRITE setMockMode NOTIFY mockModeChanged)
2430-
2431-Q_SIGNALS:
2432- void mockModeChanged(QString mode);
2433-
2434 public:
2435 explicit UsersModel(QObject *parent = 0);
2436 virtual ~UsersModel();
2437@@ -56,8 +48,8 @@
2438 int rowCount(const QModelIndex &parent) const override;
2439 QVariant data(const QModelIndex &index, int role) const override;
2440
2441- QString mockMode() const;
2442- void setMockMode(QString mockMode);
2443+private Q_SLOTS:
2444+ void resetEntries();
2445
2446 private:
2447 UsersModelPrivate * const d_ptr;
2448@@ -65,5 +57,3 @@
2449 };
2450
2451 }
2452-
2453-#endif // UNITY_MOCK_USERSMODEL_H
2454
2455=== modified file 'tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt'
2456--- tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt 2016-12-08 20:33:21 +0000
2457+++ tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt 2017-01-17 15:40:09 +0000
2458@@ -1,6 +1,7 @@
2459 include_directories(
2460 ${GLIB_INCLUDE_DIRS}
2461 ${CMAKE_CURRENT_BINARY_DIR}
2462+ ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM
2463 )
2464
2465 add_executable(GreeterDBusTestExec
2466@@ -28,7 +29,7 @@
2467 add_unity8_uitest(GreeterDBus dbus-test-runner
2468 ARG_PREFIX "--parameter"
2469 ARGS --task $<TARGET_FILE:GreeterDBusTestExec>
2470- DEPENDS MockLightDM MockLightDM-qml
2471+ DEPENDS MockLightDM
2472 )
2473
2474 add_executable(GreeterPamTestExec
2475@@ -64,12 +65,12 @@
2476 ${CMAKE_SOURCE_DIR}/plugins/LightDM
2477 ${CMAKE_SOURCE_DIR}/plugins/Utils
2478 ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
2479+ ${CMAKE_SOURCE_DIR}/tests/mocks/liblightdm/
2480 )
2481 install(TARGETS GreeterSessionsModelTestExec
2482 DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM/IntegratedLightDM"
2483 )
2484 add_unity8_uitest(GreeterSessions GreeterSessionsModelTestExec
2485- ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
2486 DEPENDS MockLightDM
2487 )
2488
2489@@ -96,7 +97,6 @@
2490 DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM/IntegratedLightDM"
2491 )
2492 add_unity8_uitest(GreeterUsers GreeterUsersModelTestExec
2493- ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
2494 DEPENDS MockLightDM
2495 )
2496
2497
2498=== modified file 'tests/plugins/LightDM/IntegratedLightDM/greeter.qml'
2499--- tests/plugins/LightDM/IntegratedLightDM/greeter.qml 2015-11-07 00:12:17 +0000
2500+++ tests/plugins/LightDM/IntegratedLightDM/greeter.qml 2017-01-17 15:40:09 +0000
2501@@ -1,5 +1,5 @@
2502 /*
2503- * Copyright 2013 Canonical Ltd.
2504+ * Copyright 2013,2015-2016 Canonical Ltd.
2505 *
2506 * This program is free software; you can redistribute it and/or modify
2507 * it under the terms of the GNU General Public License as published by
2508@@ -15,13 +15,8 @@
2509 */
2510
2511 import QtQuick 2.4
2512-import LightDM.IntegratedLightDM 0.1 as LightDM
2513+import LightDM.FullLightDM 0.1 as LightDM
2514
2515 Item {
2516 property var greeter: LightDM.Greeter
2517- Binding {
2518- target: LightDM.Greeter
2519- property: "mockMode"
2520- value: "full"
2521- }
2522 }
2523
2524=== modified file 'tests/plugins/LightDM/IntegratedLightDM/sessionsmodel.cpp'
2525--- tests/plugins/LightDM/IntegratedLightDM/sessionsmodel.cpp 2016-06-15 17:11:22 +0000
2526+++ tests/plugins/LightDM/IntegratedLightDM/sessionsmodel.cpp 2017-01-17 15:40:09 +0000
2527@@ -1,5 +1,5 @@
2528 /*
2529- * Copyright (C) 2015 Canonical, Ltd.
2530+ * Copyright (C) 2015-2016 Canonical, Ltd.
2531 *
2532 * This program is free software; you can redistribute it and/or modify
2533 * it under the terms of the GNU General Public License as published by
2534@@ -16,6 +16,8 @@
2535
2536 #include "SessionsModel.h"
2537
2538+#include "MockController.h"
2539+
2540 #include <QLightDM/SessionsModel>
2541 #include <QtCore/QModelIndex>
2542 #include <QtTest>
2543@@ -31,14 +33,14 @@
2544 {
2545 model = new SessionsModel();
2546 QVERIFY(model);
2547- sourceModel = new QLightDM::SessionsModel();
2548- QVERIFY(sourceModel);
2549+ mock = QLightDM::MockController::instance();
2550+ QVERIFY(mock);
2551 }
2552
2553 void cleanup()
2554 {
2555 delete model;
2556- delete sourceModel;
2557+ // mock will be a singleton, doesn't need to be cleaned
2558 }
2559
2560 static QModelIndex findByKey(QAbstractItemModel *model, const QString& key)
2561@@ -93,34 +95,34 @@
2562
2563 void testMultipleSessionsCountIsCorrect()
2564 {
2565- sourceModel->setTestScenario("multipleSessions");
2566- QVERIFY(sourceModel->rowCount(QModelIndex()) > 1);
2567+ mock->setProperty("sessionMode", "full");
2568+ QVERIFY(model->rowCount(QModelIndex()) > 1);
2569 }
2570
2571 void testNoSessionsCountIsCorrect()
2572 {
2573- sourceModel->setTestScenario("noSessions");
2574- QVERIFY(sourceModel->rowCount(QModelIndex()) == 0);
2575+ mock->setProperty("sessionMode", "none");
2576+ QVERIFY(model->rowCount(QModelIndex()) == 0);
2577 }
2578
2579 void testSingleSessionCountIsCorrect()
2580 {
2581- sourceModel->setTestScenario("singleSession");
2582- QVERIFY(sourceModel->rowCount(QModelIndex()) == 1);
2583+ mock->setProperty("sessionMode", "single");
2584+ QVERIFY(model->rowCount(QModelIndex()) == 1);
2585 }
2586
2587 void testSessionNameIsCorrect()
2588 {
2589 // This is testing the lookup, not the correctness of the strings,
2590 // so one test should be sufficient
2591- sourceModel->setTestScenario("multipleSessions");
2592- QVERIFY(model->data(findByKey(sourceModel, "ubuntu"),
2593+ mock->setProperty("sessionMode", "full");
2594+ QVERIFY(model->data(findByKey(model, "ubuntu"),
2595 Qt::DisplayRole).toString() == "Ubuntu");
2596 }
2597
2598 private:
2599 SessionsModel *model;
2600- QLightDM::SessionsModel *sourceModel;
2601+ QObject *mock;
2602 };
2603
2604 QTEST_MAIN(GreeterSessionsModelTest)
2605
2606=== modified file 'tests/plugins/LightDM/IntegratedLightDM/usersmodel.cpp'
2607--- tests/plugins/LightDM/IntegratedLightDM/usersmodel.cpp 2016-08-05 12:55:29 +0000
2608+++ tests/plugins/LightDM/IntegratedLightDM/usersmodel.cpp 2017-01-17 15:40:09 +0000
2609@@ -46,37 +46,27 @@
2610 {
2611 model = new UsersModel();
2612 QVERIFY(model);
2613- sourceModel = new QLightDM::UsersModel();
2614- QVERIFY(sourceModel);
2615 }
2616
2617 void cleanup()
2618 {
2619 delete model;
2620- delete sourceModel;
2621 }
2622
2623 void testMangleColor()
2624 {
2625- QString background = getStringValue(sourceModel, "color-background", QLightDM::UsersModel::BackgroundPathRole);
2626- QVERIFY(background == "#E95420");
2627-
2628- background = getStringValue(model, "color-background", QLightDM::UsersModel::BackgroundPathRole);
2629+ auto background = getStringValue(model, "color-background", QLightDM::UsersModel::BackgroundPathRole);
2630 QVERIFY(background == "data:image/svg+xml,<svg><rect width='100%' height='100%' fill='#E95420'/></svg>");
2631 }
2632
2633 void testMangleEmptyName()
2634 {
2635- QString name = getStringValue(sourceModel, "empty-name", QLightDM::UsersModel::RealNameRole);
2636- QVERIFY(name == "");
2637-
2638- name = getStringValue(model, "empty-name", QLightDM::UsersModel::RealNameRole);
2639+ auto name = getStringValue(model, "empty-name", QLightDM::UsersModel::RealNameRole);
2640 QVERIFY(name == "empty-name");
2641 }
2642
2643 private:
2644 UsersModel *model;
2645- QLightDM::UsersModel *sourceModel;
2646 };
2647
2648 QTEST_MAIN(GreeterUsersModelTest)
2649
2650=== modified file 'tests/qmltests/Dash/tst_DashShell.qml'
2651--- tests/qmltests/Dash/tst_DashShell.qml 2016-12-14 17:43:23 +0000
2652+++ tests/qmltests/Dash/tst_DashShell.qml 2017-01-17 15:40:09 +0000
2653@@ -20,12 +20,20 @@
2654 import "../../../qml/"
2655 import Ubuntu.Components 1.3
2656 import Unity.Test 0.1 as UT
2657+import LightDMController 0.1
2658+import LightDM.FullLightDM 0.1 as LightDM
2659
2660 Item {
2661 id: root
2662 width: units.gu(80)
2663 height: units.gu(80)
2664
2665+ Binding {
2666+ target: LightDMController
2667+ property: "userMode"
2668+ value: "single"
2669+ }
2670+
2671 Shell {
2672 id: shell
2673 width: parent.width / 2
2674
2675=== modified file 'tests/qmltests/Greeter/TestView.qml'
2676--- tests/qmltests/Greeter/TestView.qml 2016-08-30 14:06:47 +0000
2677+++ tests/qmltests/Greeter/TestView.qml 2017-01-17 15:40:09 +0000
2678@@ -32,6 +32,7 @@
2679 property bool alphanumeric
2680 property var userModel
2681 property var infographicModel
2682+ property bool waiting
2683 readonly property bool fullyShown: _fullyShown
2684 readonly property bool required: _required
2685 readonly property bool animating: _animating
2686
2687=== modified file 'tests/qmltests/Greeter/tst_Greeter.qml'
2688--- tests/qmltests/Greeter/tst_Greeter.qml 2016-08-30 14:06:47 +0000
2689+++ tests/qmltests/Greeter/tst_Greeter.qml 2017-01-17 15:40:09 +0000
2690@@ -22,7 +22,8 @@
2691 import AccountsService 0.1
2692 import Biometryd 0.0
2693 import GSettings 1.0
2694-import LightDM.IntegratedLightDM 0.1 as LightDM // This is the mock
2695+import LightDMController 0.1
2696+import LightDM.FullLightDM 0.1 as LightDM
2697 import Unity.Test 0.1 as UT
2698
2699 Item {
2700@@ -32,9 +33,6 @@
2701 property url defaultBackground: "/usr/share/backgrounds/warty-final-ubuntu.png"
2702
2703 Component.onCompleted: {
2704- // set the mock mode before loading
2705- LightDM.Greeter.mockMode = "full";
2706- LightDM.Users.mockMode = "full";
2707 loader.active = true;
2708 }
2709
2710@@ -146,7 +144,7 @@
2711
2712 function init() {
2713 greeterSettings.lockedOutTime = 0;
2714- LightDM.Greeter.selectUser = "";
2715+ LightDMController.selectUserHint = "";
2716 greeter.failedLoginsDelayAttempts = 7;
2717 greeter.failedLoginsDelayMinutes = 5;
2718 teaseSpy.clear();
2719@@ -570,20 +568,20 @@
2720 }
2721
2722 function test_selectUserHint() {
2723- LightDM.Greeter.selectUser = "info-prompt";
2724+ LightDMController.selectUserHint = "info-prompt";
2725 resetLoader();
2726 var i = verifySelected("info-prompt");
2727 verify(i != 0); // sanity-check that info-prompt isn't default 0 answer
2728 }
2729
2730 function test_selectUserHintUnset() {
2731- LightDM.Greeter.selectUser = "";
2732+ LightDMController.selectUserHint = "";
2733 resetLoader();
2734 verifySelected(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
2735 }
2736
2737 function test_selectUserHintInvalid() {
2738- LightDM.Greeter.selectUser = "not-a-real-user";
2739+ LightDMController.selectUserHint = "not-a-real-user";
2740 resetLoader();
2741 verifySelected(LightDM.Users.data(0, LightDM.UserRoles.NameRole));
2742 }
2743
2744=== modified file 'tests/qmltests/Greeter/tst_Infographics.qml'
2745--- tests/qmltests/Greeter/tst_Infographics.qml 2016-10-25 08:14:40 +0000
2746+++ tests/qmltests/Greeter/tst_Infographics.qml 2017-01-17 15:40:09 +0000
2747@@ -20,19 +20,9 @@
2748 import "../../../qml/Greeter"
2749 import Ubuntu.Components 1.3
2750 import Unity.Test 0.1 as UT
2751-import LightDM.IntegratedLightDM 0.1 as LightDM
2752+import LightDM.FullLightDM 0.1 as LightDM
2753
2754 Item {
2755- Binding {
2756- target: LightDM.Greeter
2757- property: "mockMode"
2758- value: "full"
2759- }
2760- Binding {
2761- target: LightDM.Users
2762- property: "mockMode"
2763- value: "full"
2764- }
2765 property variant infographicModel: LightDM.Infographic
2766
2767 width: units.gu(120)
2768
2769=== modified file 'tests/qmltests/Greeter/tst_NarrowView.qml'
2770--- tests/qmltests/Greeter/tst_NarrowView.qml 2016-08-30 20:23:15 +0000
2771+++ tests/qmltests/Greeter/tst_NarrowView.qml 2017-01-17 15:40:09 +0000
2772@@ -18,7 +18,8 @@
2773 import QtTest 1.0
2774 import ".."
2775 import "../../../qml/Greeter"
2776-import LightDM.IntegratedLightDM 0.1 as LightDM
2777+import LightDMController 0.1
2778+import LightDM.FullLightDM 0.1 as LightDM
2779 import Ubuntu.Components 1.3
2780 import Ubuntu.Telephony 0.1 as Telephony
2781 import Unity.Test 0.1 as UT
2782@@ -30,6 +31,12 @@
2783
2784 Component.onCompleted: theme.name = "Ubuntu.Components.Themes.SuruDark" // use the same theme as the real shell
2785
2786+ Binding {
2787+ target: LightDMController
2788+ property: "userMode"
2789+ value: "single"
2790+ }
2791+
2792 Row {
2793 anchors.fill: parent
2794 Loader {
2795@@ -252,7 +259,7 @@
2796 Binding {
2797 target: LightDM.Infographic
2798 property: "username"
2799- value: "single"
2800+ value: "has-password"
2801 }
2802
2803 SignalSpy {
2804
2805=== modified file 'tests/qmltests/Greeter/tst_WideView.qml'
2806--- tests/qmltests/Greeter/tst_WideView.qml 2016-08-30 14:06:47 +0000
2807+++ tests/qmltests/Greeter/tst_WideView.qml 2017-01-17 15:40:09 +0000
2808@@ -18,7 +18,8 @@
2809 import QtTest 1.0
2810 import ".."
2811 import "../../../qml/Greeter"
2812-import LightDM.IntegratedLightDM 0.1 as LightDM
2813+import LightDMController 0.1
2814+import LightDM.FullLightDM 0.1 as LightDM
2815 import Ubuntu.Components 1.3
2816 import Unity.Test 0.1 as UT
2817
2818@@ -31,12 +32,6 @@
2819
2820 theme.name: "Ubuntu.Components.Themes.SuruDark"
2821
2822- Binding {
2823- target: LightDM.Users
2824- property: "mockMode"
2825- value: "full"
2826- }
2827-
2828 Row {
2829 anchors.fill: parent
2830 Loader {
2831@@ -271,15 +266,15 @@
2832 id: multipleSessionsCheckbox
2833 onClicked: {
2834 if (checked) {
2835- LightDM.Sessions.testScenario = "multipleSessions"
2836+ LightDMController.sessionMode = "full";
2837 } else {
2838- LightDM.Sessions.testScenario = "singleSession"
2839+ LightDMController.sessionMode = "single";
2840 }
2841 }
2842 Connections {
2843- target: LightDM.Sessions
2844- onTestScenarioChanged: {
2845- if (LightDM.Sessions.testScenario === "multipleSessions") {
2846+ target: LightDMController
2847+ onSessionModeChanged: {
2848+ if (LightDMController.sessionMode === "full") {
2849 multipleSessionsCheckbox.checked = true;
2850 } else {
2851 multipleSessionsCheckbox.checked = false;
2852@@ -297,11 +292,11 @@
2853
2854 width: units.gu(10)
2855 minimumValue: 0
2856- maximumValue: LightDM.Sessions.numAvailableSessions
2857- value: LightDM.Sessions.numSessions
2858- visible: LightDM.Sessions.testScenario === "multipleSessions"
2859+ maximumValue: LightDMController.numAvailableSessions
2860+ value: LightDMController.numSessions
2861+ visible: LightDMController.sessionMode === "full"
2862 Binding {
2863- target: LightDM.Sessions
2864+ target: LightDMController
2865 property: "numSessions"
2866 value: numSessionsSlider.value
2867 }
2868@@ -368,7 +363,8 @@
2869 respondedSpy.clear();
2870 teaseSpy.clear();
2871 emergencySpy.clear();
2872- LightDM.Sessions.testScenario = "multipleSessions"
2873+ LightDMController.sessionMode = "full";
2874+ LightDM.Sessions.iconSearchDirectories = [testIconDirectory];
2875 }
2876
2877 function cleanup() {
2878@@ -426,10 +422,6 @@
2879 }
2880
2881 function test_sessionIconsAreValid() {
2882- LightDM.Sessions.testScenario = "multipleSessions"
2883- var originalDirectories = LightDM.Sessions.iconSearchDirectories
2884- LightDM.Sessions.iconSearchDirectories = [testIconDirectory]
2885-
2886 selectUser("has-password");
2887
2888 // Test the login list icon is valid
2889@@ -449,12 +441,10 @@
2890
2891 function test_choosingNewSessionChangesLoginListIcon() {
2892 // Ensure the default session is selected (Ubuntu)
2893- loader.active = false;
2894- loader.active = true;
2895+ cleanup();
2896
2897 selectUser("has-password");
2898
2899- LightDM.Sessions.testScenario = "multipleSessions";
2900 var sessionChooserButton = findChild(view, "sessionChooserButton");
2901 var icon = String(sessionChooserButton.icon);
2902 compare(icon.indexOf("ubuntu") > -1, true);
2903@@ -465,25 +455,25 @@
2904 var currentDelegate = findChild(view, delegateName);
2905 var sessionKey = LightDM.Sessions.data(i,LightDM.SessionRoles.KeyRole);
2906 if (sessionKey === "gnome-classic") {
2907+ waitForRendering(currentDelegate);
2908 tap(currentDelegate);
2909- var sessionChooserButton = findChild(view, "sessionChooserButton");
2910 waitForRendering(sessionChooserButton);
2911- var icon = String(sessionChooserButton.icon);
2912 break;
2913 }
2914 }
2915
2916+ icon = String(sessionChooserButton.icon);
2917 compare(icon.indexOf("gnome") > -1, true,
2918 "Expected icon to contain gnome but it was " + icon);
2919 }
2920
2921 function test_noSessionsDoesntBreakView() {
2922- LightDM.Sessions.testScenario = "noSessions"
2923+ LightDMController.sessionMode = "none";
2924 compare(LightDM.Sessions.count, 0)
2925 }
2926
2927 function test_sessionIconNotShownWithOneSession() {
2928- LightDM.Sessions.testScenario = "singleSession"
2929+ LightDMController.sessionMode = "single";
2930 compare(LightDM.Sessions.count, 1);
2931
2932 var sessionChooserButton = findChild(view, "sessionChooserButton");
2933@@ -491,7 +481,7 @@
2934 }
2935
2936 function test_sessionIconNotShownWithActiveUser() {
2937- LightDM.Sessions.testScenario = "multipleSessions";
2938+ LightDMController.sessionMode = "full";
2939 compare(LightDM.Sessions.count > 1, true);
2940
2941 selectUser("active");
2942@@ -501,7 +491,7 @@
2943 }
2944
2945 function test_sessionIconShownWithMultipleSessions() {
2946- LightDM.Sessions.testScenario = "multipleSessions"
2947+ LightDMController.sessionMode = "full";
2948 compare(LightDM.Sessions.count > 1, true);
2949
2950 selectUser("has-password");
2951
2952=== modified file 'tests/qmltests/Tutorial/tst_Tutorial.qml'
2953--- tests/qmltests/Tutorial/tst_Tutorial.qml 2016-12-05 14:08:55 +0000
2954+++ tests/qmltests/Tutorial/tst_Tutorial.qml 2017-01-17 15:40:09 +0000
2955@@ -17,7 +17,8 @@
2956 import QtQuick 2.4
2957 import QtTest 1.0
2958 import AccountsService 0.1
2959-import LightDM.IntegratedLightDM 0.1 as LightDM
2960+import LightDMController 0.1
2961+import LightDM.FullLightDM 0.1 as LightDM
2962 import Ubuntu.Components 1.3
2963 import Ubuntu.Components.ListItems 1.3
2964 import Ubuntu.Telephony 0.1 as Telephony
2965@@ -85,8 +86,7 @@
2966
2967 Component.onCompleted: {
2968 // must set the mock mode before loading the Shell
2969- LightDM.Greeter.mockMode = "single-pin";
2970- LightDM.Users.mockMode = "single-pin";
2971+ LightDMController.userMode = "single-pin";
2972 shellLoader.active = true;
2973 }
2974
2975
2976=== modified file 'tests/qmltests/tst_OrientedShell.qml'
2977--- tests/qmltests/tst_OrientedShell.qml 2016-12-12 16:45:09 +0000
2978+++ tests/qmltests/tst_OrientedShell.qml 2017-01-17 15:40:09 +0000
2979@@ -22,7 +22,8 @@
2980 import Ubuntu.Components.ListItems 1.3 as ListItem
2981 import Unity.Application 0.1
2982 import Unity.Test 0.1
2983-import LightDM.IntegratedLightDM 0.1 as LightDM
2984+import LightDMController 0.1
2985+import LightDM.FullLightDM 0.1 as LightDM
2986 import Powerd 0.1
2987 import Unity.InputInfo 0.1
2988 import Utils 0.1
2989@@ -38,6 +39,12 @@
2990 width: units.gu(160) + controls.width
2991 height: units.gu(100)
2992
2993+ Binding {
2994+ target: LightDMController
2995+ property: "userMode"
2996+ value: "single"
2997+ }
2998+
2999 QtObject {
3000 id: applicationArguments
3001 property string deviceName: "mako"
3002
3003=== modified file 'tests/qmltests/tst_Shell.qml'
3004--- tests/qmltests/tst_Shell.qml 2017-01-09 14:10:17 +0000
3005+++ tests/qmltests/tst_Shell.qml 2017-01-17 15:40:09 +0000
3006@@ -18,7 +18,8 @@
3007 import QtTest 1.0
3008 import AccountsService 0.1
3009 import GSettings 1.0
3010-import LightDM.IntegratedLightDM 0.1 as LightDM
3011+import LightDMController 0.1
3012+import LightDM.FullLightDM 0.1 as LightDM
3013 import SessionBroadcast 0.1
3014 import Ubuntu.Components 1.3
3015 import Ubuntu.Components.ListItems 1.3 as ListItem
3016@@ -48,8 +49,7 @@
3017
3018 Component.onCompleted: {
3019 // must set the mock mode before loading the Shell
3020- LightDM.Greeter.mockMode = "single";
3021- LightDM.Users.mockMode = "single";
3022+ LightDMController.userMode = "single";
3023 shellLoader.active = true;
3024 }
3025
3026@@ -248,8 +248,7 @@
3027 model: ["single", "single-passphrase", "single-pin", "full"]
3028 onSelectedIndexChanged: {
3029 testCase.tearDown();
3030- LightDM.Greeter.mockMode = model[selectedIndex];
3031- LightDM.Users.mockMode = model[selectedIndex];
3032+ LightDMController.userMode = model[selectedIndex];
3033 shellLoader.active = true;
3034 }
3035 }
3036@@ -881,8 +880,7 @@
3037 }
3038
3039 function setLightDMMockMode(mode) {
3040- LightDM.Greeter.mockMode = mode;
3041- LightDM.Users.mockMode = mode;
3042+ LightDMController.userMode = mode;
3043 }
3044
3045 function test_showInputMethod() {
3046
3047=== modified file 'tests/qmltests/tst_ShellWithPin.qml'
3048--- tests/qmltests/tst_ShellWithPin.qml 2017-01-03 12:04:08 +0000
3049+++ tests/qmltests/tst_ShellWithPin.qml 2017-01-17 15:40:09 +0000
3050@@ -19,7 +19,8 @@
3051 import QtTest 1.0
3052 import AccountsService 0.1
3053 import GSettings 1.0
3054-import LightDM.IntegratedLightDM 0.1 as LightDM
3055+import LightDMController 0.1
3056+import LightDM.FullLightDM 0.1 as LightDM
3057 import Ubuntu.SystemImage 0.1
3058 import Ubuntu.Telephony 0.1 as Telephony
3059 import Unity.Application 0.1
3060@@ -35,8 +36,7 @@
3061
3062 Component.onCompleted: {
3063 // must set the mock mode before loading the Shell
3064- LightDM.Greeter.mockMode = "single-pin";
3065- LightDM.Users.mockMode = "single-pin";
3066+ LightDMController.userMode = "single-pin";
3067 shellLoader.active = true;
3068 }
3069

Subscribers

People subscribed via source and target branches