Merge lp:~mikemc/unity-scope-click/fix-dlmgr-tests into lp:unity-scope-click

Proposed by Mike McCracken
Status: Merged
Approved by: dobey
Approved revision: 171
Merged at revision: 181
Proposed branch: lp:~mikemc/unity-scope-click/fix-dlmgr-tests
Merge into: lp:unity-scope-click
Diff against target: 57 lines (+13/-9)
1 file modified
scope/tests/test_download_manager.cpp (+13/-9)
To merge this branch: bzr merge lp:~mikemc/unity-scope-click/fix-dlmgr-tests
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
dobey (community) Approve
Review via email: mp+208434@code.launchpad.net

Commit message

- Fix broken tests for download manager.

Description of the change

- Fix broken tests for download manager. Still disabled.

bzr branch lp:~mikemc/unity-scope-click/fix-dlmgr-tests
cd fix-dlmgr-tests
mkdir build
cmake .. -DCMAKE_BUILD_TYPE=debug
make -j
GTEST_ALSO_RUN_DISABLED_TESTS=1 make test

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scope/tests/test_download_manager.cpp'
2--- scope/tests/test_download_manager.cpp 2014-02-19 22:35:42 +0000
3+++ scope/tests/test_download_manager.cpp 2014-02-26 17:17:40 +0000
4@@ -363,9 +363,12 @@
5 mockSystemDownloadManager);
6
7 // mockError is heap-allocated because downloadWithError will delete it.
8- MockError *mockError = new MockError();
9- MockDownload downloadWithError(mockError);
10- MockDownload successfulDownload;
11+ MockError mockError; // = new MockError();
12+ NiceMock<MockDownload> downloadWithError(&mockError);
13+ ON_CALL(downloadWithError, isError()).WillByDefault(Return(true));
14+ ON_CALL(downloadWithError, error()).WillByDefault(Return(&mockError));
15+ NiceMock<MockDownload> successfulDownload;
16+ ON_CALL(successfulDownload, isError()).WillByDefault(Return(false));
17
18 // Just directly signal clickTokenFetched or error from
19 // getCredentials(), no need to re-test the same code as the
20@@ -390,13 +393,13 @@
21 // behave correctly without mock return values, using overridden constructors:
22 if (p.downloadSignalsError) {
23
24- EXPECT_CALL(*mockError, errorString()).Times(1).WillOnce(Return(TEST_DOWNLOADERROR_STRING));
25+ EXPECT_CALL(mockError, errorString()).Times(1).WillOnce(Return(TEST_DOWNLOADERROR_STRING));
26 downloadCreatedSignalFunc = std::function<void()>([&](){
27 mockSystemDownloadManager->downloadCreated(&downloadWithError);
28 });
29
30 } else {
31- EXPECT_CALL(*mockError, errorString()).Times(0);
32+ EXPECT_CALL(mockError, errorString()).Times(0);
33 downloadCreatedSignalFunc = std::function<void()>([&](){
34 mockSystemDownloadManager->downloadCreated(&successfulDownload);
35 });
36@@ -422,6 +425,8 @@
37 QObject::connect(&dm, &click::DownloadManager::downloadStarted,
38 [&mockDownloadManagerClient](const QString& downloadId)
39 {
40+ qDebug() << "in lambda connected to click::dm::downloadstarted";
41+
42 mockDownloadManagerClient.onDownloadStartedEmitted(downloadId);
43 });
44
45@@ -435,10 +440,9 @@
46 &DISABLED_DownloadManagerStartDownloadTest::Quit));
47
48 EXPECT_CALL(mockDownloadManagerClient, onDownloadErrorEmitted(_)).Times(0);
49-
50- // when https://bugs.launchpad.net/ubuntu-download-manager/+bug/1278789
51- // is fixed, we can add this assertion:
52- // EXPECT_CALL(successfulDownload, start()).Times(1);
53+ EXPECT_CALL(successfulDownload, id()).Times(1).WillOnce(Return(TEST_DOWNLOAD_ID));
54+ EXPECT_CALL(successfulDownload, start()).Times(1);
55+
56
57 } else {
58

Subscribers

People subscribed via source and target branches

to all changes: