diff options
author | Songchun Fan <schfan@google.com> | 2021-04-14 19:04:11 +0000 |
---|---|---|
committer | Songchun Fan <schfan@google.com> | 2021-04-16 02:29:24 +0000 |
commit | 5ada1508c2e8cf005258e04117bf38fee759f31e (patch) | |
tree | 70b916edb279b878216359a2d1544419c47e8a7b /services/incremental/test/IncrementalServiceTest.cpp | |
parent | e53db0d40254f57d8af33e0dcac43e464a06bd31 (diff) |
[pm] remove incremental startable/unstartable code
Also remove streaming health status reporting which could cause
startable state change because it is also not needed any more.
BUG: 171920377
Test: builds
Change-Id: I7284e7a63df79da7dbf3d16ff64302b3d1ce1348
Diffstat (limited to 'services/incremental/test/IncrementalServiceTest.cpp')
-rw-r--r-- | services/incremental/test/IncrementalServiceTest.cpp | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/services/incremental/test/IncrementalServiceTest.cpp b/services/incremental/test/IncrementalServiceTest.cpp index 14bcd4e7b9ba..6a3d953f74aa 100644 --- a/services/incremental/test/IncrementalServiceTest.cpp +++ b/services/incremental/test/IncrementalServiceTest.cpp @@ -184,18 +184,6 @@ public: setAndReportStatus(id, IDataLoaderStatusListener::DATA_LOADER_IMAGE_READY); return binder::Status::ok(); } - binder::Status storageError(int32_t id) { - if (mListener) { - mListener->reportStreamHealth(id, IDataLoaderStatusListener::STREAM_STORAGE_ERROR); - } - return binder::Status::ok(); - } - binder::Status transportError(int32_t id) { - if (mListener) { - mListener->reportStreamHealth(id, IDataLoaderStatusListener::STREAM_INTEGRITY_ERROR); - } - return binder::Status::ok(); - } int32_t setStorageParams(bool enableReadLogs) { int32_t result = -1; EXPECT_NE(mServiceConnector.get(), nullptr); @@ -1904,87 +1892,6 @@ TEST_F(IncrementalServiceTest, testStartDataLoaderUnbindOnAllDoneWithReadlogs) { ASSERT_EQ(mDataLoader->status(), IDataLoaderStatusListener::DATA_LOADER_DESTROYED); } -TEST_F(IncrementalServiceTest, testRegisterStorageHealthListenerSuccess) { - mIncFs->openMountSuccess(); - sp<NiceMock<MockStorageHealthListener>> listener{new NiceMock<MockStorageHealthListener>}; - sp<NiceMock<MockStorageHealthListener>> newListener{new NiceMock<MockStorageHealthListener>}; - NiceMock<MockStorageHealthListener>* newListenerMock = newListener.get(); - - TemporaryDir tempDir; - int storageId = - mIncrementalService->createStorage(tempDir.path, mDataLoaderParcel, - IncrementalService::CreateOptions::CreateNew); - ASSERT_GE(storageId, 0); - mIncrementalService->startLoading(storageId, std::move(mDataLoaderParcel), {}, {}, listener, - {}); - - StorageHealthCheckParams newParams; - newParams.blockedTimeoutMs = 10000; - newParams.unhealthyTimeoutMs = 20000; - newParams.unhealthyMonitoringMs = 30000; - ASSERT_TRUE(mIncrementalService->registerStorageHealthListener(storageId, std::move(newParams), - newListener)); - - using MS = std::chrono::milliseconds; - using MCS = std::chrono::microseconds; - - const auto blockedTimeout = MS(newParams.blockedTimeoutMs); - const auto unhealthyTimeout = MS(newParams.unhealthyTimeoutMs); - - const uint64_t kFirstTimestampUs = 1000000000ll; - const uint64_t kBlockedTimestampUs = - kFirstTimestampUs - std::chrono::duration_cast<MCS>(blockedTimeout).count(); - const uint64_t kUnhealthyTimestampUs = - kFirstTimestampUs - std::chrono::duration_cast<MCS>(unhealthyTimeout).count(); - - // test that old listener was not called - EXPECT_CALL(*listener.get(), - onHealthStatus(_, IStorageHealthListener::HEALTH_STATUS_READS_PENDING)) - .Times(0); - EXPECT_CALL(*newListenerMock, - onHealthStatus(_, IStorageHealthListener::HEALTH_STATUS_READS_PENDING)) - .Times(1); - EXPECT_CALL(*newListenerMock, onHealthStatus(_, IStorageHealthListener::HEALTH_STATUS_BLOCKED)) - .Times(1); - EXPECT_CALL(*newListenerMock, - onHealthStatus(_, IStorageHealthListener::HEALTH_STATUS_UNHEALTHY_STORAGE)) - .Times(1); - EXPECT_CALL(*newListenerMock, - onHealthStatus(_, IStorageHealthListener::HEALTH_STATUS_UNHEALTHY_TRANSPORT)) - .Times(1); - mIncFs->waitForPendingReadsSuccess(kFirstTimestampUs); - mLooper->mCallback(-1, -1, mLooper->mCallbackData); - - ASSERT_EQ(IStorageHealthListener::HEALTH_STATUS_READS_PENDING, newListener->mStatus); - ASSERT_EQ(storageId, newListener->mStorageId); - - auto timedCallback = mTimedQueue->mWhat; - mTimedQueue->clearJob(storageId); - - // test when health status is blocked with transport error - mDataLoader->transportError(storageId); - mIncFs->waitForPendingReadsSuccess(kBlockedTimestampUs); - timedCallback(); - ASSERT_EQ(IStorageHealthListener::HEALTH_STATUS_BLOCKED, newListener->mStatus); - timedCallback = mTimedQueue->mWhat; - mTimedQueue->clearJob(storageId); - - // test when health status is blocked with storage error - mDataLoader->storageError(storageId); - mIncFs->waitForPendingReadsSuccess(kBlockedTimestampUs); - timedCallback(); - ASSERT_EQ(IStorageHealthListener::HEALTH_STATUS_UNHEALTHY_STORAGE, newListener->mStatus); - timedCallback = mTimedQueue->mWhat; - mTimedQueue->clearJob(storageId); - - // test when health status is unhealthy with transport error - mDataLoader->transportError(storageId); - mIncFs->waitForPendingReadsSuccess(kUnhealthyTimestampUs); - timedCallback(); - ASSERT_EQ(IStorageHealthListener::HEALTH_STATUS_UNHEALTHY_TRANSPORT, newListener->mStatus); - mTimedQueue->clearJob(storageId); -} - static std::vector<PerUidReadTimeouts> createPerUidTimeouts( std::initializer_list<std::tuple<int, int, int, int>> tuples) { std::vector<PerUidReadTimeouts> result; |