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
=== modified file 'scope/tests/test_download_manager.cpp'
--- scope/tests/test_download_manager.cpp 2014-02-19 22:35:42 +0000
+++ scope/tests/test_download_manager.cpp 2014-02-26 17:17:40 +0000
@@ -363,9 +363,12 @@
363 mockSystemDownloadManager);363 mockSystemDownloadManager);
364364
365 // mockError is heap-allocated because downloadWithError will delete it.365 // mockError is heap-allocated because downloadWithError will delete it.
366 MockError *mockError = new MockError();366 MockError mockError; // = new MockError();
367 MockDownload downloadWithError(mockError);367 NiceMock<MockDownload> downloadWithError(&mockError);
368 MockDownload successfulDownload;368 ON_CALL(downloadWithError, isError()).WillByDefault(Return(true));
369 ON_CALL(downloadWithError, error()).WillByDefault(Return(&mockError));
370 NiceMock<MockDownload> successfulDownload;
371 ON_CALL(successfulDownload, isError()).WillByDefault(Return(false));
369372
370 // Just directly signal clickTokenFetched or error from373 // Just directly signal clickTokenFetched or error from
371 // getCredentials(), no need to re-test the same code as the374 // getCredentials(), no need to re-test the same code as the
@@ -390,13 +393,13 @@
390 // behave correctly without mock return values, using overridden constructors:393 // behave correctly without mock return values, using overridden constructors:
391 if (p.downloadSignalsError) {394 if (p.downloadSignalsError) {
392395
393 EXPECT_CALL(*mockError, errorString()).Times(1).WillOnce(Return(TEST_DOWNLOADERROR_STRING));396 EXPECT_CALL(mockError, errorString()).Times(1).WillOnce(Return(TEST_DOWNLOADERROR_STRING));
394 downloadCreatedSignalFunc = std::function<void()>([&](){397 downloadCreatedSignalFunc = std::function<void()>([&](){
395 mockSystemDownloadManager->downloadCreated(&downloadWithError);398 mockSystemDownloadManager->downloadCreated(&downloadWithError);
396 });399 });
397400
398 } else {401 } else {
399 EXPECT_CALL(*mockError, errorString()).Times(0);402 EXPECT_CALL(mockError, errorString()).Times(0);
400 downloadCreatedSignalFunc = std::function<void()>([&](){403 downloadCreatedSignalFunc = std::function<void()>([&](){
401 mockSystemDownloadManager->downloadCreated(&successfulDownload);404 mockSystemDownloadManager->downloadCreated(&successfulDownload);
402 });405 });
@@ -422,6 +425,8 @@
422 QObject::connect(&dm, &click::DownloadManager::downloadStarted,425 QObject::connect(&dm, &click::DownloadManager::downloadStarted,
423 [&mockDownloadManagerClient](const QString& downloadId)426 [&mockDownloadManagerClient](const QString& downloadId)
424 {427 {
428 qDebug() << "in lambda connected to click::dm::downloadstarted";
429
425 mockDownloadManagerClient.onDownloadStartedEmitted(downloadId);430 mockDownloadManagerClient.onDownloadStartedEmitted(downloadId);
426 });431 });
427432
@@ -435,10 +440,9 @@
435 &DISABLED_DownloadManagerStartDownloadTest::Quit));440 &DISABLED_DownloadManagerStartDownloadTest::Quit));
436441
437 EXPECT_CALL(mockDownloadManagerClient, onDownloadErrorEmitted(_)).Times(0);442 EXPECT_CALL(mockDownloadManagerClient, onDownloadErrorEmitted(_)).Times(0);
438443 EXPECT_CALL(successfulDownload, id()).Times(1).WillOnce(Return(TEST_DOWNLOAD_ID));
439 // when https://bugs.launchpad.net/ubuntu-download-manager/+bug/1278789444 EXPECT_CALL(successfulDownload, start()).Times(1);
440 // is fixed, we can add this assertion:445
441 // EXPECT_CALL(successfulDownload, start()).Times(1);
442446
443 } else {447 } else {
444448

Subscribers

People subscribed via source and target branches

to all changes: