apexd_test_utils.h: remove IsOk
There is a better alternative in result-gmock.h
Test: presubmit
Change-Id: I688cc6f9e6e27dd42e6f768d7529117b8eedaa42
diff --git a/apexd/apex_file_repository_test.cpp b/apexd/apex_file_repository_test.cpp
index 1af1c45..ff88720 100644
--- a/apexd/apex_file_repository_test.cpp
+++ b/apexd/apex_file_repository_test.cpp
@@ -19,6 +19,7 @@
#include <android-base/file.h>
#include <android-base/logging.h>
#include <android-base/properties.h>
+#include <android-base/result-gmock.h>
#include <android-base/stringprintf.h>
#include <errno.h>
#include <gmock/gmock.h>
@@ -41,10 +42,11 @@
namespace fs = std::filesystem;
using android::apex::testing::ApexFileEq;
-using android::apex::testing::IsOk;
using android::base::GetExecutableDirectory;
using android::base::StringPrintf;
+using android::base::testing::Ok;
using ::testing::ByRef;
+using ::testing::Not;
using ::testing::UnorderedElementsAre;
static std::string GetTestDataDir() { return GetExecutableDirectory(); }
@@ -83,30 +85,30 @@
fs::copy(GetTestFile("apex.apexd_test_different_app.apex"), data_dir.path);
ApexFileRepository instance;
- ASSERT_TRUE(IsOk(instance.AddPreInstalledApex({built_in_dir.path})));
- ASSERT_TRUE(IsOk(instance.AddDataApex(data_dir.path)));
+ ASSERT_RESULT_OK(instance.AddPreInstalledApex({built_in_dir.path}));
+ ASSERT_RESULT_OK(instance.AddDataApex(data_dir.path));
// Now test that apexes were scanned correctly;
auto test_fn = [&](const std::string& apex_name) {
auto apex = ApexFile::Open(GetTestFile(apex_name));
- ASSERT_TRUE(IsOk(apex));
+ ASSERT_RESULT_OK(apex);
{
auto ret = instance.GetPublicKey(apex->GetManifest().name());
- ASSERT_TRUE(IsOk(ret));
+ ASSERT_RESULT_OK(ret);
ASSERT_EQ(apex->GetBundledPublicKey(), *ret);
}
{
auto ret = instance.GetPreinstalledPath(apex->GetManifest().name());
- ASSERT_TRUE(IsOk(ret));
+ ASSERT_RESULT_OK(ret);
ASSERT_EQ(StringPrintf("%s/%s", built_in_dir.path, apex_name.c_str()),
*ret);
}
{
auto ret = instance.GetDataPath(apex->GetManifest().name());
- ASSERT_TRUE(IsOk(ret));
+ ASSERT_RESULT_OK(ret);
ASSERT_EQ(StringPrintf("%s/%s", data_dir.path, apex_name.c_str()), *ret);
}
@@ -118,8 +120,8 @@
test_fn("apex.apexd_test_different_app.apex");
// Check that second call will succeed as well.
- ASSERT_TRUE(IsOk(instance.AddPreInstalledApex({built_in_dir.path})));
- ASSERT_TRUE(IsOk(instance.AddDataApex(data_dir.path)));
+ ASSERT_RESULT_OK(instance.AddPreInstalledApex({built_in_dir.path}));
+ ASSERT_RESULT_OK(instance.AddDataApex(data_dir.path));
test_fn("apex.apexd_test.apex");
test_fn("apex.apexd_test_different_app.apex");
@@ -133,7 +135,7 @@
td.path);
ApexFileRepository instance;
- ASSERT_FALSE(IsOk(instance.AddPreInstalledApex({td.path})));
+ ASSERT_THAT(instance.AddPreInstalledApex({td.path}), Not(Ok()));
}
TEST(ApexFileRepositoryTest, InitializeCompressedApexWithoutApex) {
@@ -144,7 +146,7 @@
ApexFileRepository instance;
// Compressed APEX without APEX cannot be opened
- ASSERT_FALSE(IsOk(instance.AddPreInstalledApex({td.path})));
+ ASSERT_THAT(instance.AddPreInstalledApex({td.path}), Not(Ok()));
}
TEST(ApexFileRepositoryTest, InitializeSameNameDifferentPathAborts) {
@@ -177,9 +179,9 @@
persist_prefix, bootconfig_prefix});
auto test_fn = [&](const std::string& selected_filename) {
- ASSERT_TRUE(IsOk(instance.AddPreInstalledApex({td.path})));
+ ASSERT_RESULT_OK(instance.AddPreInstalledApex({td.path}));
auto ret = instance.GetPreinstalledPath(apex_name);
- ASSERT_TRUE(IsOk(ret));
+ ASSERT_RESULT_OK(ret);
ASSERT_EQ(StringPrintf("%s/%s", td.path, selected_filename.c_str()), *ret);
instance.Reset();
};
@@ -214,9 +216,9 @@
ApexFileRepository instance(
/*enforce_multi_install_partition=*/false,
/*multi_install_select_prop_prefixes=*/{prop_prefix});
- ASSERT_TRUE(IsOk(instance.AddPreInstalledApex({td.path})));
+ ASSERT_RESULT_OK(instance.AddPreInstalledApex({td.path}));
// Neither version should be have been installed.
- ASSERT_FALSE(IsOk(instance.GetPreinstalledPath(apex_name)));
+ ASSERT_THAT(instance.GetPreinstalledPath(apex_name), Not(Ok()));
android::base::SetProperty(prop, "");
}
@@ -239,9 +241,9 @@
ApexFileRepository instance(
/*enforce_multi_install_partition=*/true,
/*multi_install_select_prop_prefixes=*/{prop_prefix});
- ASSERT_TRUE(IsOk(instance.AddPreInstalledApex({td.path})));
+ ASSERT_RESULT_OK(instance.AddPreInstalledApex({td.path}));
// Neither version should be have been installed.
- ASSERT_FALSE(IsOk(instance.GetPreinstalledPath(apex_name)));
+ ASSERT_THAT(instance.GetPreinstalledPath(apex_name), Not(Ok()));
android::base::SetProperty(prop, "");
}
@@ -268,15 +270,15 @@
fs::copy(GetTestFile("apex.apexd_test.apex"), td.path);
ApexFileRepository instance;
- ASSERT_TRUE(IsOk(instance.AddPreInstalledApex({td.path})));
+ ASSERT_RESULT_OK(instance.AddPreInstalledApex({td.path}));
// Check that apex was loaded.
auto path = instance.GetPreinstalledPath("com.android.apex.test_package");
- ASSERT_TRUE(IsOk(path));
+ ASSERT_RESULT_OK(path);
ASSERT_EQ(StringPrintf("%s/apex.apexd_test.apex", td.path), *path);
auto public_key = instance.GetPublicKey("com.android.apex.test_package");
- ASSERT_TRUE(IsOk(public_key));
+ ASSERT_RESULT_OK(public_key);
// Substitute it with another apex with the same name, but different public
// key.
@@ -285,7 +287,7 @@
{
auto apex = ApexFile::Open(*path);
- ASSERT_TRUE(IsOk(apex));
+ ASSERT_RESULT_OK(apex);
// Check module name hasn't changed.
ASSERT_EQ("com.android.apex.test_package", apex->GetManifest().name());
// Check public key has changed.
@@ -302,16 +304,16 @@
fs::copy(GetTestFile("com.android.apex.compressed.v1.capex"), td.path);
ApexFileRepository instance;
- ASSERT_TRUE(IsOk(instance.AddPreInstalledApex({td.path})));
+ ASSERT_RESULT_OK(instance.AddPreInstalledApex({td.path}));
// Check that apex was loaded.
auto path = instance.GetPreinstalledPath("com.android.apex.compressed");
- ASSERT_TRUE(IsOk(path));
+ ASSERT_RESULT_OK(path);
ASSERT_EQ(StringPrintf("%s/com.android.apex.compressed.v1.capex", td.path),
*path);
auto public_key = instance.GetPublicKey("com.android.apex.compressed");
- ASSERT_TRUE(IsOk(public_key));
+ ASSERT_RESULT_OK(public_key);
// Substitute it with another apex with the same name, but different public
// key.
@@ -320,7 +322,7 @@
{
auto apex = ApexFile::Open(*path);
- ASSERT_TRUE(IsOk(apex));
+ ASSERT_RESULT_OK(apex);
// Check module name hasn't changed.
ASSERT_EQ("com.android.apex.compressed", apex->GetManifest().name());
// Check public key has changed.
@@ -337,26 +339,26 @@
fs::copy(GetTestFile("com.android.apex.compressed.v1.capex"), td.path);
ApexFileRepository instance;
- ASSERT_TRUE(IsOk(instance.AddPreInstalledApex({td.path})));
+ ASSERT_RESULT_OK(instance.AddPreInstalledApex({td.path}));
auto compressed_apex = ApexFile::Open(
StringPrintf("%s/com.android.apex.compressed.v1.capex", td.path));
- ASSERT_TRUE(IsOk(compressed_apex));
+ ASSERT_RESULT_OK(compressed_apex);
ASSERT_TRUE(instance.IsPreInstalledApex(*compressed_apex));
auto apex1 = ApexFile::Open(StringPrintf("%s/apex.apexd_test.apex", td.path));
- ASSERT_TRUE(IsOk(apex1));
+ ASSERT_RESULT_OK(apex1);
ASSERT_TRUE(instance.IsPreInstalledApex(*apex1));
// It's same apex, but path is different. Shouldn't be treated as
// pre-installed.
auto apex2 = ApexFile::Open(GetTestFile("apex.apexd_test.apex"));
- ASSERT_TRUE(IsOk(apex2));
+ ASSERT_RESULT_OK(apex2);
ASSERT_FALSE(instance.IsPreInstalledApex(*apex2));
auto apex3 =
ApexFile::Open(GetTestFile("apex.apexd_test_different_app.apex"));
- ASSERT_TRUE(IsOk(apex3));
+ ASSERT_RESULT_OK(apex3);
ASSERT_FALSE(instance.IsPreInstalledApex(*apex3));
}
@@ -399,8 +401,8 @@
kDecompressedApexPackageSuffix));
ApexFileRepository instance(decompression_dir.path);
- ASSERT_TRUE(IsOk(instance.AddPreInstalledApex({built_in_dir.path})));
- ASSERT_TRUE(IsOk(instance.AddDataApex(data_dir.path)));
+ ASSERT_RESULT_OK(instance.AddPreInstalledApex({built_in_dir.path}));
+ ASSERT_RESULT_OK(instance.AddDataApex(data_dir.path));
// ApexFileRepository should only deal with APEX in /data/apex/active.
// Decompressed APEX should not be included
@@ -417,7 +419,7 @@
fs::copy(GetTestFile("com.android.apex.compressed.v1.capex"), data_dir.path);
ApexFileRepository instance;
- ASSERT_TRUE(IsOk(instance.AddDataApex(data_dir.path)));
+ ASSERT_RESULT_OK(instance.AddDataApex(data_dir.path));
auto data_apexs = instance.GetDataApexFiles();
ASSERT_EQ(data_apexs.size(), 0u);
@@ -429,7 +431,7 @@
fs::copy(GetTestFile("apex.apexd_test.apex"), data_dir.path);
ApexFileRepository instance;
- ASSERT_TRUE(IsOk(instance.AddDataApex(data_dir.path)));
+ ASSERT_RESULT_OK(instance.AddDataApex(data_dir.path));
auto data_apexs = instance.GetDataApexFiles();
ASSERT_EQ(data_apexs.size(), 0u);
@@ -443,8 +445,8 @@
fs::copy(GetTestFile("apex.apexd_test_v2.apex"), data_dir.path);
ApexFileRepository instance;
- ASSERT_TRUE(IsOk(instance.AddPreInstalledApex({built_in_dir.path})));
- ASSERT_TRUE(IsOk(instance.AddDataApex(data_dir.path)));
+ ASSERT_RESULT_OK(instance.AddPreInstalledApex({built_in_dir.path}));
+ ASSERT_RESULT_OK(instance.AddDataApex(data_dir.path));
auto data_apexs = instance.GetDataApexFiles();
auto normal_apex =
@@ -460,8 +462,8 @@
built_in_dir.path, decompression_dir.path);
ApexFileRepository instance(decompression_dir.path);
- ASSERT_TRUE(IsOk(instance.AddPreInstalledApex({built_in_dir.path})));
- ASSERT_TRUE(IsOk(instance.AddDataApex(data_dir.path)));
+ ASSERT_RESULT_OK(instance.AddPreInstalledApex({built_in_dir.path}));
+ ASSERT_RESULT_OK(instance.AddDataApex(data_dir.path));
auto data_apexs = instance.GetDataApexFiles();
ASSERT_EQ(data_apexs.size(), 0u);
@@ -474,8 +476,8 @@
fs::copy(GetTestFile("apex.apexd_test_different_key.apex"), data_dir.path);
ApexFileRepository instance;
- ASSERT_TRUE(IsOk(instance.AddPreInstalledApex({built_in_dir.path})));
- ASSERT_TRUE(IsOk(instance.AddDataApex(data_dir.path)));
+ ASSERT_RESULT_OK(instance.AddPreInstalledApex({built_in_dir.path}));
+ ASSERT_RESULT_OK(instance.AddDataApex(data_dir.path));
auto data_apexs = instance.GetDataApexFiles();
ASSERT_EQ(data_apexs.size(), 0u);
@@ -489,7 +491,7 @@
built_in_dir.path);
ApexFileRepository instance;
- ASSERT_TRUE(IsOk(instance.AddPreInstalledApex({built_in_dir.path})));
+ ASSERT_RESULT_OK(instance.AddPreInstalledApex({built_in_dir.path}));
auto pre_installed_apexs = instance.GetPreInstalledApexFiles();
auto pre_apex_1 = ApexFile::Open(
@@ -508,11 +510,11 @@
fs::copy(GetTestFile("com.android.apex.compressed.v1.capex"),
built_in_dir.path);
ApexFileRepository instance;
- ASSERT_TRUE(IsOk(instance.AddPreInstalledApex({built_in_dir.path})));
+ ASSERT_RESULT_OK(instance.AddPreInstalledApex({built_in_dir.path}));
TemporaryDir data_dir;
fs::copy(GetTestFile("com.android.apex.cts.shim.v2.apex"), data_dir.path);
- ASSERT_TRUE(IsOk(instance.AddDataApex(data_dir.path)));
+ ASSERT_RESULT_OK(instance.AddDataApex(data_dir.path));
auto result = instance.AllApexFilesByName();
@@ -543,8 +545,8 @@
fs::copy(GetTestFile("apex.apexd_test_v2.apex"), data_dir.path);
ApexFileRepository instance;
- ASSERT_TRUE(IsOk(instance.AddPreInstalledApex({built_in_dir.path})));
- ASSERT_TRUE(IsOk(instance.AddDataApex(data_dir.path)));
+ ASSERT_RESULT_OK(instance.AddPreInstalledApex({built_in_dir.path}));
+ ASSERT_RESULT_OK(instance.AddDataApex(data_dir.path));
auto apex =
ApexFile::Open(StringPrintf("%s/apex.apexd_test_v2.apex", data_dir.path));
@@ -569,7 +571,7 @@
fs::copy(GetTestFile("apex.apexd_test.apex"), built_in_dir.path);
ApexFileRepository instance;
- ASSERT_TRUE(IsOk(instance.AddPreInstalledApex({built_in_dir.path})));
+ ASSERT_RESULT_OK(instance.AddPreInstalledApex({built_in_dir.path}));
auto apex = ApexFile::Open(
StringPrintf("%s/apex.apexd_test.apex", built_in_dir.path));
@@ -694,11 +696,11 @@
// foo is added, but bar is not
auto ret_foo = instance.GetPreinstalledPath("com.android.apex.test_package");
- ASSERT_TRUE(IsOk(ret_foo));
+ ASSERT_RESULT_OK(ret_foo);
ASSERT_EQ(apex_foo_path, *ret_foo);
auto ret_bar =
instance.GetPreinstalledPath("com.android.apex.test_package_2");
- ASSERT_FALSE(IsOk(ret_bar));
+ ASSERT_THAT(ret_bar, Not(Ok()));
}
TEST_F(ApexFileRepositoryTestAddBlockApex, FailsWhenTheresDuplicateNames) {
@@ -722,7 +724,7 @@
ApexFileRepository instance;
auto status = instance.AddBlockApex(metadata_partition_path);
- ASSERT_FALSE(IsOk(status));
+ ASSERT_THAT(status, Not(Ok()));
}
TEST_F(ApexFileRepositoryTestAddBlockApex, GetBlockApexRootDigest) {
@@ -750,7 +752,7 @@
// call ApexFileRepository::AddBlockApex()
ApexFileRepository instance;
auto status = instance.AddBlockApex(metadata_partition_path);
- ASSERT_TRUE(IsOk(status));
+ ASSERT_RESULT_OK(status);
ASSERT_EQ(hex_root_digest, instance.GetBlockApexRootDigest(apex_foo_path));
}
@@ -776,7 +778,7 @@
// call ApexFileRepository::AddBlockApex()
ApexFileRepository instance;
auto status = instance.AddBlockApex(metadata_partition_path);
- ASSERT_TRUE(IsOk(status));
+ ASSERT_RESULT_OK(status);
ASSERT_EQ(last_update_seconds,
instance.GetBlockApexLastUpdateSeconds(apex_foo_path));
@@ -809,7 +811,7 @@
// call ApexFileRepository::AddBlockApex()
ApexFileRepository instance;
auto status = instance.AddBlockApex(metadata_partition_path);
- ASSERT_TRUE(IsOk(status));
+ ASSERT_RESULT_OK(status);
}
TEST_F(ApexFileRepositoryTestAddBlockApex, VerifyPublicKeyWhenAddingBlockApex) {
@@ -831,7 +833,7 @@
// call ApexFileRepository::AddBlockApex()
ApexFileRepository instance;
auto status = instance.AddBlockApex(metadata_partition_path);
- ASSERT_FALSE(IsOk(status));
+ ASSERT_THAT(status, Not(Ok()));
}
TEST_F(ApexFileRepositoryTestAddBlockApex,
@@ -854,7 +856,7 @@
// call ApexFileRepository::AddBlockApex()
ApexFileRepository instance;
auto status = instance.AddBlockApex(metadata_partition_path);
- ASSERT_FALSE(IsOk(status));
+ ASSERT_THAT(status, Not(Ok()));
}
TEST_F(ApexFileRepositoryTestAddBlockApex,
@@ -877,7 +879,7 @@
// call ApexFileRepository::AddBlockApex()
ApexFileRepository instance;
auto status = instance.AddBlockApex(metadata_partition_path);
- ASSERT_FALSE(IsOk(status));
+ ASSERT_THAT(status, Not(Ok()));
}
TEST_F(ApexFileRepositoryTestAddBlockApex, RespectIsFactoryBitFromMetadata) {
@@ -900,7 +902,7 @@
// call ApexFileRepository::AddBlockApex()
ApexFileRepository instance;
auto status = instance.AddBlockApex(metadata_partition_path);
- ASSERT_TRUE(IsOk(status))
+ ASSERT_RESULT_OK(status)
<< "failed to add block apex with is_factory=" << is_factory;
ASSERT_EQ(is_factory,
instance.HasPreInstalledVersion("com.android.apex.test_package"));
diff --git a/apexd/apexd_session_test.cpp b/apexd/apexd_session_test.cpp
index 816d98d..2daf0bf 100644
--- a/apexd/apexd_session_test.cpp
+++ b/apexd/apexd_session_test.cpp
@@ -38,7 +38,6 @@
namespace apex {
namespace {
-using android::apex::testing::IsOk;
using android::base::Join;
using android::base::make_scope_guard;
using android::base::testing::Ok;
@@ -112,17 +111,17 @@
TestApexSession session1(239, SessionState::SUCCESS);
TestApexSession session2(1543, SessionState::ACTIVATION_FAILED);
- ASSERT_TRUE(IsOk(ApexSession::MigrateToMetadataSessionsDir()));
+ ASSERT_RESULT_OK(ApexSession::MigrateToMetadataSessionsDir());
auto sessions = ApexSession::GetSessions();
ASSERT_EQ(2u, sessions.size()) << Join(sessions, ',');
auto migrated_session_1 = ApexSession::GetSession(239);
- ASSERT_TRUE(IsOk(migrated_session_1));
+ ASSERT_RESULT_OK(migrated_session_1);
ASSERT_EQ(SessionState::SUCCESS, migrated_session_1->GetState());
auto migrated_session_2 = ApexSession::GetSession(1543);
- ASSERT_TRUE(IsOk(migrated_session_2));
+ ASSERT_RESULT_OK(migrated_session_2);
ASSERT_EQ(SessionState::ACTIVATION_FAILED, migrated_session_2->GetState());
}
diff --git a/apexd/apexd_test_utils.h b/apexd/apexd_test_utils.h
index dbd7785..b198115 100644
--- a/apexd/apexd_test_utils.h
+++ b/apexd/apexd_test_utils.h
@@ -48,15 +48,6 @@
namespace apex {
namespace testing {
-template <typename T>
-inline ::testing::AssertionResult IsOk(const android::base::Result<T>& result) {
- if (result.ok()) {
- return ::testing::AssertionSuccess() << " is Ok";
- } else {
- return ::testing::AssertionFailure() << " failed with " << result.error();
- }
-}
-
inline ::testing::AssertionResult IsOk(const android::binder::Status& status) {
if (status.isOk()) {
return ::testing::AssertionSuccess() << " is Ok";
diff --git a/apexd/apexd_utils_test.cpp b/apexd/apexd_utils_test.cpp
index cbbc45e..e4ecc2c 100644
--- a/apexd/apexd_utils_test.cpp
+++ b/apexd/apexd_utils_test.cpp
@@ -14,22 +14,23 @@
* limitations under the License.
*/
+#include "apexd_utils.h"
+
+#include <android-base/file.h>
+#include <android-base/result-gmock.h>
+#include <android-base/result.h>
+#include <android-base/stringprintf.h>
+#include <android-base/strings.h>
+#include <errno.h>
+#include <gtest/gtest.h>
+
#include <filesystem>
#include <fstream>
#include <new>
#include <string>
-#include <errno.h>
-
-#include <android-base/file.h>
-#include <android-base/result.h>
-#include <android-base/stringprintf.h>
-#include <android-base/strings.h>
-#include <gtest/gtest.h>
-
#include "apexd.h"
#include "apexd_test_utils.h"
-#include "apexd_utils.h"
namespace android {
namespace apex {
@@ -37,10 +38,11 @@
namespace fs = std::filesystem;
-using android::apex::testing::IsOk;
using android::base::Basename;
using android::base::Join;
using android::base::StringPrintf;
+using android::base::testing::Ok;
+using ::testing::Not;
using ::testing::UnorderedElementsAre;
using ::testing::UnorderedElementsAreArray;
@@ -55,13 +57,13 @@
TemporaryFile nested_file(child_dir);
auto content = ReadDir(root_dir.path, [](auto _) { return true; });
- IsOk(content);
+ ASSERT_RESULT_OK(content);
ASSERT_EQ(content->size(), 3u);
auto del_result = DeleteDirContent(root_dir.path);
- IsOk(del_result);
+ ASSERT_RESULT_OK(del_result);
content = ReadDir(root_dir.path, [](auto _) { return true; });
- IsOk(content);
+ ASSERT_RESULT_OK(content);
ASSERT_EQ(content->size(), 0u);
}
@@ -69,7 +71,7 @@
TemporaryDir first_dir;
TemporaryDir second_dir;
auto result = FindFirstExistingDirectory(first_dir.path, second_dir.path);
- ASSERT_TRUE(IsOk(result));
+ ASSERT_RESULT_OK(result);
ASSERT_EQ(*result, first_dir.path);
}
@@ -77,7 +79,7 @@
TemporaryDir first_dir;
auto second_dir = "/data/local/tmp/does/not/exist";
auto result = FindFirstExistingDirectory(first_dir.path, second_dir);
- ASSERT_TRUE(IsOk(result));
+ ASSERT_RESULT_OK(result);
ASSERT_EQ(*result, first_dir.path);
}
@@ -85,7 +87,7 @@
auto first_dir = "/data/local/tmp/does/not/exist";
TemporaryDir second_dir;
auto result = FindFirstExistingDirectory(first_dir, second_dir.path);
- ASSERT_TRUE(IsOk(result));
+ ASSERT_RESULT_OK(result);
ASSERT_EQ(*result, second_dir.path);
}
@@ -93,14 +95,14 @@
auto first_dir = "/data/local/tmp/does/not/exist";
auto second_dir = "/data/local/tmp/also/does/not/exist";
auto result = FindFirstExistingDirectory(first_dir, second_dir);
- ASSERT_FALSE(IsOk(result));
+ ASSERT_THAT(result, Not(Ok()));
}
TEST(ApexdUtilTest, FindFirstExistingDirectoryFirstFileSecondDir) {
TemporaryFile first_file;
TemporaryDir second_dir;
auto result = FindFirstExistingDirectory(first_file.path, second_dir.path);
- ASSERT_TRUE(IsOk(result));
+ ASSERT_RESULT_OK(result);
ASSERT_EQ(*result, second_dir.path);
}
@@ -108,7 +110,7 @@
TemporaryDir first_dir;
TemporaryFile second_file;
auto result = FindFirstExistingDirectory(first_dir.path, second_file.path);
- ASSERT_TRUE(IsOk(result));
+ ASSERT_RESULT_OK(result);
ASSERT_EQ(*result, first_dir.path);
}
@@ -116,21 +118,21 @@
TemporaryFile first_file;
TemporaryFile second_file;
auto result = FindFirstExistingDirectory(first_file.path, second_file.path);
- ASSERT_FALSE(IsOk(result));
+ ASSERT_THAT(result, Not(Ok()));
}
TEST(ApexdUtilTest, FindFirstExistingDirectoryFirstFileSecondDoesNotExist) {
TemporaryFile first_file;
auto second_dir = "/data/local/tmp/does/not/exist";
auto result = FindFirstExistingDirectory(first_file.path, second_dir);
- ASSERT_FALSE(IsOk(result));
+ ASSERT_THAT(result, Not(Ok()));
}
TEST(ApexdUtilTest, FindFirstExistingDirectoryFirsDoesNotExistSecondFile) {
auto first_dir = "/data/local/tmp/does/not/exist";
TemporaryFile second_file;
auto result = FindFirstExistingDirectory(first_dir, second_file.path);
- ASSERT_FALSE(IsOk(result));
+ ASSERT_THAT(result, Not(Ok()));
}
TEST(ApexdUtilTest, MoveDir) {
@@ -145,7 +147,7 @@
TemporaryFile from_2(from_subdir);
auto result = MoveDir(from.path, to.path);
- ASSERT_TRUE(IsOk(result));
+ ASSERT_RESULT_OK(result);
ASSERT_TRUE(fs::is_empty(from.path));
std::vector<std::string> content;
@@ -164,19 +166,19 @@
TEST(ApexdUtilTest, MoveDirFromIsNotDirectory) {
TemporaryFile from;
TemporaryDir to;
- ASSERT_FALSE(IsOk(MoveDir(from.path, to.path)));
+ ASSERT_THAT(MoveDir(from.path, to.path), Not(Ok()));
}
TEST(ApexdUtilTest, MoveDirToIsNotDirectory) {
TemporaryDir from;
TemporaryFile to;
TemporaryFile from_1(from.path);
- ASSERT_FALSE(IsOk(MoveDir(from.path, to.path)));
+ ASSERT_THAT(MoveDir(from.path, to.path), Not(Ok()));
}
TEST(ApexdUtilTest, MoveDirFromDoesNotExist) {
TemporaryDir to;
- ASSERT_FALSE(IsOk(MoveDir("/data/local/tmp/does/not/exist", to.path)));
+ ASSERT_THAT(MoveDir("/data/local/tmp/does/not/exist", to.path), Not(Ok()));
}
TEST(ApexdUtilTest, MoveDirToDoesNotExist) {
@@ -190,7 +192,7 @@
}
TemporaryFile from_2(from_subdir);
- ASSERT_FALSE(IsOk(MoveDir(from.path, "/data/local/tmp/does/not/exist")));
+ ASSERT_THAT(MoveDir(from.path, "/data/local/tmp/does/not/exist"), Not(Ok()));
// Check that |from| directory is not empty.
std::vector<std::string> content;
@@ -217,7 +219,7 @@
std::ofstream fourth_file(fourth_filename);
auto result = FindFilesBySuffix(td.path, {".b", ".c"});
- ASSERT_TRUE(IsOk(result));
+ ASSERT_RESULT_OK(result);
ASSERT_THAT(*result, UnorderedElementsAre(second_filename, third_filename,
fourth_filename));
}
@@ -244,10 +246,10 @@
auto original_apex_mounts = GetApexMounts();
ASSERT_GT(original_apex_mounts.size(), 0u);
auto original_dir_content = ReadDir("/apex", [](auto _) { return true; });
- ASSERT_TRUE(IsOk(original_dir_content));
+ ASSERT_RESULT_OK(original_dir_content);
{
MountNamespaceRestorer restorer;
- ASSERT_TRUE(IsOk(SetUpApexTestEnvironment()));
+ ASSERT_RESULT_OK(SetUpApexTestEnvironment());
// Check /apex is apex_mnt_dir.
char* context;
ASSERT_GT(getfilecon("/apex", &context), 0);
@@ -258,7 +260,7 @@
ASSERT_EQ(new_apex_mounts.size(), 0u);
// Check that /apex is empty.
auto dir_content = ReadDir("/apex", [](auto _) { return true; });
- ASSERT_TRUE(IsOk(dir_content));
+ ASSERT_RESULT_OK(dir_content);
ASSERT_EQ(dir_content->size(), 0u)
<< "Found following entries: " << Join(*dir_content, ',');
// Check that we can still access /data.
@@ -275,7 +277,7 @@
auto apex_mounts = GetApexMounts();
ASSERT_THAT(apex_mounts, UnorderedElementsAreArray(original_apex_mounts));
auto apex_dir_content = ReadDir("/apex", [](auto _) { return true; });
- ASSERT_TRUE(IsOk(apex_dir_content));
+ ASSERT_RESULT_OK(apex_dir_content);
ASSERT_EQ(apex_dir_content->size(), original_dir_content->size());
}
diff --git a/apexd/apexd_verity_test.cpp b/apexd/apexd_verity_test.cpp
index 4e53ccb..8838880 100644
--- a/apexd/apexd_verity_test.cpp
+++ b/apexd/apexd_verity_test.cpp
@@ -14,29 +14,31 @@
* limitations under the License.
*/
-#include <string>
-
-#include <errno.h>
-#include <sys/stat.h>
+#include "apexd_verity.h"
#include <android-base/file.h>
#include <android-base/logging.h>
+#include <android-base/result-gmock.h>
#include <android-base/stringprintf.h>
+#include <errno.h>
#include <gtest/gtest.h>
+#include <sys/stat.h>
+
+#include <string>
#include "apex_file.h"
#include "apexd_test_utils.h"
-#include "apexd_verity.h"
namespace android {
namespace apex {
using namespace std::literals;
-using android::apex::testing::IsOk;
using android::base::GetExecutableDirectory;
using android::base::ReadFileToString;
using android::base::StringPrintf;
+using android::base::testing::Ok;
+using ::testing::Not;
static std::string GetTestDataDir() { return GetExecutableDirectory(); }
static std::string GetTestFile(const std::string& name) {
@@ -47,13 +49,13 @@
TemporaryDir td;
auto apex = ApexFile::Open(GetTestFile("apex.apexd_test_no_hashtree.apex"));
- ASSERT_TRUE(IsOk(apex));
+ ASSERT_RESULT_OK(apex);
auto verity_data = apex->VerifyApexVerity(apex->GetBundledPublicKey());
- ASSERT_TRUE(IsOk(verity_data));
+ ASSERT_RESULT_OK(verity_data);
auto hashtree_file = StringPrintf("%s/hashtree", td.path);
auto status = PrepareHashTree(*apex, *verity_data, hashtree_file);
- ASSERT_TRUE(IsOk(status));
+ ASSERT_RESULT_OK(status);
ASSERT_EQ(KRegenerate, *status);
std::string first_hashtree;
@@ -63,7 +65,7 @@
// Now call PrepareHashTree again. Since digest matches, hashtree should be
// reused.
status = PrepareHashTree(*apex, *verity_data, hashtree_file);
- ASSERT_TRUE(IsOk(status));
+ ASSERT_RESULT_OK(status);
ASSERT_EQ(kReuse, *status);
std::string second_hashtree;
@@ -79,13 +81,13 @@
TemporaryDir td;
auto apex = ApexFile::Open(GetTestFile("apex.apexd_test_no_hashtree.apex"));
- ASSERT_TRUE(IsOk(apex));
+ ASSERT_RESULT_OK(apex);
auto verity_data = apex->VerifyApexVerity(apex->GetBundledPublicKey());
- ASSERT_TRUE(IsOk(verity_data));
+ ASSERT_RESULT_OK(verity_data);
auto hashtree_file = StringPrintf("%s/hashtree", td.path);
auto status = PrepareHashTree(*apex, *verity_data, hashtree_file);
- ASSERT_TRUE(IsOk(status));
+ ASSERT_RESULT_OK(status);
ASSERT_EQ(KRegenerate, *status);
std::string first_hashtree;
@@ -94,14 +96,14 @@
auto apex2 =
ApexFile::Open(GetTestFile("apex.apexd_test_no_hashtree_2.apex"));
- ASSERT_TRUE(IsOk(apex2));
+ ASSERT_RESULT_OK(apex2);
auto verity_data2 = apex2->VerifyApexVerity(apex2->GetBundledPublicKey());
- ASSERT_TRUE(IsOk(verity_data2));
+ ASSERT_RESULT_OK(verity_data2);
// Now call PrepareHashTree again. Since digest doesn't match, hashtree
// should be regenerated.
status = PrepareHashTree(*apex2, *verity_data2, hashtree_file);
- ASSERT_TRUE(IsOk(status));
+ ASSERT_RESULT_OK(status);
ASSERT_EQ(KRegenerate, *status);
std::string second_hashtree;
@@ -117,11 +119,11 @@
auto apex =
ApexFile::Open(GetTestFile("com.android.apex.compressed.v1.capex"));
- ASSERT_TRUE(IsOk(apex));
+ ASSERT_RESULT_OK(apex);
std::string hash_tree;
ApexVerityData verity_data;
auto result = PrepareHashTree(*apex, verity_data, hash_tree);
- ASSERT_FALSE(IsOk(result));
+ ASSERT_THAT(result, Not(Ok()));
ASSERT_THAT(
result.error().message(),
::testing::HasSubstr("Cannot prepare HashTree of compressed APEX"));
diff --git a/apexd/apexservice_test.cpp b/apexd/apexservice_test.cpp
index eaacbd5..d31c4c1 100644
--- a/apexd/apexservice_test.cpp
+++ b/apexd/apexservice_test.cpp
@@ -18,6 +18,7 @@
#include <android-base/logging.h>
#include <android-base/macros.h>
#include <android-base/properties.h>
+#include <android-base/result-gmock.h>
#include <android-base/scopeguard.h>
#include <android-base/stringprintf.h>
#include <android-base/strings.h>
@@ -79,6 +80,7 @@
using android::base::StartsWith;
using android::base::StringPrintf;
using android::base::unique_fd;
+using android::base::testing::Ok;
using android::dm::DeviceMapper;
using ::apex::proto::ApexManifest;
using ::apex::proto::SessionState;
@@ -298,7 +300,7 @@
// Failure in constructor. Redo work to get error message.
auto fail_fn = [&]() {
Result<ApexFile> apex_file = ApexFile::Open(test_input);
- ASSERT_FALSE(IsOk(apex_file));
+ ASSERT_THAT(apex_file, Not(Ok()));
ASSERT_TRUE(apex_file.ok())
<< test_input << " failed to load: " << apex_file.error();
};
@@ -737,7 +739,7 @@
TEST_F(ApexServiceTest, GetFactoryPackages) {
Result<std::vector<ApexInfo>> factory_packages = GetFactoryPackages();
- ASSERT_TRUE(IsOk(factory_packages));
+ ASSERT_RESULT_OK(factory_packages);
ASSERT_TRUE(factory_packages->size() > 0);
std::vector<std::string> builtin_dirs;
@@ -766,10 +768,10 @@
TEST_F(ApexServiceTest, NoPackagesAreBothActiveAndInactive) {
Result<std::vector<ApexInfo>> active_packages = GetActivePackages();
- ASSERT_TRUE(IsOk(active_packages));
+ ASSERT_RESULT_OK(active_packages);
ASSERT_TRUE(active_packages->size() > 0);
Result<std::vector<ApexInfo>> inactive_packages = GetInactivePackages();
- ASSERT_TRUE(IsOk(inactive_packages));
+ ASSERT_RESULT_OK(inactive_packages);
std::vector<std::string> active_packages_strings =
GetPackagesStrings(*active_packages);
std::vector<std::string> inactive_packages_strings =
@@ -786,12 +788,14 @@
TEST_F(ApexServiceTest, GetAllPackages) {
Result<std::vector<ApexInfo>> all_packages = GetAllPackages();
- ASSERT_TRUE(IsOk(all_packages));
+ ASSERT_RESULT_OK(all_packages);
ASSERT_TRUE(all_packages->size() > 0);
Result<std::vector<ApexInfo>> active_packages = GetActivePackages();
+ ASSERT_RESULT_OK(active_packages);
std::vector<std::string> active_strings =
GetPackagesStrings(*active_packages);
Result<std::vector<ApexInfo>> factory_packages = GetFactoryPackages();
+ ASSERT_RESULT_OK(factory_packages);
std::vector<std::string> factory_strings =
GetPackagesStrings(*factory_packages);
for (ApexInfo& apexInfo : *all_packages) {
@@ -995,9 +999,9 @@
TEST_F(ApexServiceTest, MarkStagedSessionSuccessfulFailsSessionInWrongState) {
auto session = ApexSession::CreateSession(73);
- ASSERT_TRUE(IsOk(session));
- ASSERT_TRUE(
- IsOk(session->UpdateStateAndCommit(::apex::proto::SessionState::STAGED)));
+ ASSERT_RESULT_OK(session);
+ ASSERT_RESULT_OK(
+ session->UpdateStateAndCommit(::apex::proto::SessionState::STAGED));
ASSERT_FALSE(IsOk(service_->markStagedSessionSuccessful(73)));
@@ -1010,9 +1014,9 @@
TEST_F(ApexServiceTest, MarkStagedSessionSuccessfulActivatedSession) {
auto session = ApexSession::CreateSession(239);
- ASSERT_TRUE(IsOk(session));
- ASSERT_TRUE(IsOk(
- session->UpdateStateAndCommit(::apex::proto::SessionState::ACTIVATED)));
+ ASSERT_RESULT_OK(session);
+ ASSERT_RESULT_OK(
+ session->UpdateStateAndCommit(::apex::proto::SessionState::ACTIVATED));
ASSERT_TRUE(IsOk(service_->markStagedSessionSuccessful(239)));
@@ -1025,9 +1029,9 @@
TEST_F(ApexServiceTest, MarkStagedSessionSuccessfulNoOp) {
auto session = ApexSession::CreateSession(1543);
- ASSERT_TRUE(IsOk(session));
- ASSERT_TRUE(IsOk(
- session->UpdateStateAndCommit(::apex::proto::SessionState::SUCCESS)));
+ ASSERT_RESULT_OK(session);
+ ASSERT_RESULT_OK(
+ session->UpdateStateAndCommit(::apex::proto::SessionState::SUCCESS));
ASSERT_TRUE(IsOk(service_->markStagedSessionSuccessful(1543)));
@@ -1041,9 +1045,9 @@
// Should be able to abort individual staged session
TEST_F(ApexServiceTest, AbortStagedSession) {
auto session1 = ApexSession::CreateSession(239);
- ASSERT_TRUE(IsOk(session1->UpdateStateAndCommit(SessionState::VERIFIED)));
+ ASSERT_RESULT_OK(session1->UpdateStateAndCommit(SessionState::VERIFIED));
auto session2 = ApexSession::CreateSession(240);
- ASSERT_TRUE(IsOk(session2->UpdateStateAndCommit(SessionState::STAGED)));
+ ASSERT_RESULT_OK(session2->UpdateStateAndCommit(SessionState::STAGED));
std::vector<ApexSessionInfo> sessions;
ASSERT_TRUE(IsOk(service_->getSessions(&sessions)));
@@ -1061,9 +1065,9 @@
// abortStagedSession should not abort activated session
TEST_F(ApexServiceTest, AbortStagedSessionActivatedFail) {
auto session1 = ApexSession::CreateSession(239);
- ASSERT_TRUE(IsOk(session1->UpdateStateAndCommit(SessionState::ACTIVATED)));
+ ASSERT_RESULT_OK(session1->UpdateStateAndCommit(SessionState::ACTIVATED));
auto session2 = ApexSession::CreateSession(240);
- ASSERT_TRUE(IsOk(session2->UpdateStateAndCommit(SessionState::STAGED)));
+ ASSERT_RESULT_OK(session2->UpdateStateAndCommit(SessionState::STAGED));
std::vector<ApexSessionInfo> sessions;
ASSERT_TRUE(IsOk(service_->getSessions(&sessions)));
@@ -1098,7 +1102,7 @@
for (auto i = 0u; i < states.size(); i++) {
auto session = ApexSession::CreateSession(230 + i);
SessionState::State state = states[i];
- ASSERT_TRUE(IsOk(session->UpdateStateAndCommit(state)));
+ ASSERT_RESULT_OK(session->UpdateStateAndCommit(state));
if (!session->IsFinalized()) {
nonFinalSessions++;
}
@@ -1138,7 +1142,7 @@
// Make sure that /data/apex/active has activated packages.
auto active_pkgs = ReadEntireDir(kActiveApexPackagesDataDir);
- ASSERT_TRUE(IsOk(active_pkgs));
+ ASSERT_RESULT_OK(active_pkgs);
ASSERT_THAT(*active_pkgs,
UnorderedElementsAre(installer1.test_installed_file,
installer2.test_installed_file));
@@ -1149,7 +1153,7 @@
ASSERT_TRUE(IsOk(service_->submitStagedSession(params, &list)));
auto backups = ReadEntireDir(kApexBackupDir);
- ASSERT_TRUE(IsOk(backups));
+ ASSERT_RESULT_OK(backups);
auto backup1 =
StringPrintf("%s/com.android.apex.test_package@1.apex", kApexBackupDir);
auto backup2 =
@@ -1173,7 +1177,7 @@
}
// Make sure /data/apex/backups exists.
- ASSERT_TRUE(IsOk(CreateDirIfNeeded(std::string(kApexBackupDir), 0700)));
+ ASSERT_RESULT_OK(CreateDirIfNeeded(std::string(kApexBackupDir), 0700));
// Create some bogus files in /data/apex/backups.
std::ofstream old_backup(StringPrintf("%s/file1", kApexBackupDir));
ASSERT_TRUE(old_backup.good());
@@ -1184,7 +1188,7 @@
// Make sure that /data/apex/active has activated packages.
auto active_pkgs = ReadEntireDir(kActiveApexPackagesDataDir);
- ASSERT_TRUE(IsOk(active_pkgs));
+ ASSERT_RESULT_OK(active_pkgs);
ASSERT_THAT(*active_pkgs,
UnorderedElementsAre(installer1.test_installed_file,
installer2.test_installed_file));
@@ -1195,7 +1199,7 @@
ASSERT_TRUE(IsOk(service_->submitStagedSession(params, &list)));
auto backups = ReadEntireDir(kApexBackupDir);
- ASSERT_TRUE(IsOk(backups));
+ ASSERT_RESULT_OK(backups);
auto backup1 =
StringPrintf("%s/com.android.apex.test_package@1.apex", kApexBackupDir);
auto backup2 =
@@ -1216,10 +1220,10 @@
}
// Make sure that /data/apex/active exists and is empty
- ASSERT_TRUE(
- IsOk(CreateDirIfNeeded(std::string(kActiveApexPackagesDataDir), 0755)));
+ ASSERT_RESULT_OK(
+ CreateDirIfNeeded(std::string(kActiveApexPackagesDataDir), 0755));
auto active_pkgs = ReadEntireDir(kActiveApexPackagesDataDir);
- ASSERT_TRUE(IsOk(active_pkgs));
+ ASSERT_RESULT_OK(active_pkgs);
ASSERT_EQ(0u, active_pkgs->size());
ApexInfoList list;
@@ -1228,7 +1232,7 @@
ASSERT_TRUE(IsOk(service_->submitStagedSession(params, &list)));
auto backups = ReadEntireDir(kApexBackupDir);
- ASSERT_TRUE(IsOk(backups));
+ ASSERT_RESULT_OK(backups);
ASSERT_EQ(0u, backups->size());
}
@@ -1251,7 +1255,7 @@
if (!supports_fs_checkpointing_) {
auto backups = ReadEntireDir(kApexBackupDir);
- ASSERT_TRUE(IsOk(backups));
+ ASSERT_RESULT_OK(backups);
ASSERT_EQ(0u, backups->size());
}
}
@@ -1261,7 +1265,7 @@
void SetUp() override { ApexServiceTest::SetUp(); }
void PrepareBackup(const std::vector<std::string>& pkgs) {
- ASSERT_TRUE(IsOk(CreateDirIfNeeded(std::string(kApexBackupDir), 0700)));
+ ASSERT_RESULT_OK(CreateDirIfNeeded(std::string(kApexBackupDir), 0700));
for (const auto& pkg : pkgs) {
PrepareTestApexForInstall installer(pkg);
ASSERT_TRUE(installer.Prepare()) << " failed to prepare " << pkg;
@@ -1284,7 +1288,7 @@
// Now read content and check it contains expected values.
auto active_pkgs = ReadEntireDir(kActiveApexPackagesDataDir);
- ASSERT_TRUE(IsOk(active_pkgs));
+ ASSERT_RESULT_OK(active_pkgs);
ASSERT_THAT(*active_pkgs, UnorderedElementsAreArray(expected_pkgs));
}
};
@@ -1301,8 +1305,8 @@
}
auto session = ApexSession::CreateSession(1543);
- ASSERT_TRUE(IsOk(session));
- ASSERT_TRUE(IsOk(session->UpdateStateAndCommit(SessionState::ACTIVATED)));
+ ASSERT_RESULT_OK(session);
+ ASSERT_RESULT_OK(session->UpdateStateAndCommit(SessionState::ACTIVATED));
// Make sure /data/apex/active is non-empty.
ASSERT_TRUE(IsOk(service_->stagePackages({installer.test_file})));
@@ -1331,8 +1335,8 @@
}
auto session = ApexSession::CreateSession(1543);
- ASSERT_TRUE(IsOk(session));
- ASSERT_TRUE(IsOk(session->UpdateStateAndCommit(SessionState::ACTIVATED)));
+ ASSERT_RESULT_OK(session);
+ ASSERT_RESULT_OK(session->UpdateStateAndCommit(SessionState::ACTIVATED));
// Make sure /data/apex/active is non-empty.
ASSERT_TRUE(IsOk(service_->stagePackages({installer.test_file})));
@@ -1381,8 +1385,8 @@
GetTestFile("apex.apexd_test_different_app.apex")});
auto session = ApexSession::CreateSession(101);
- ASSERT_TRUE(IsOk(session));
- ASSERT_TRUE(IsOk(session->UpdateStateAndCommit(SessionState::ACTIVATED)));
+ ASSERT_RESULT_OK(session);
+ ASSERT_RESULT_OK(session->UpdateStateAndCommit(SessionState::ACTIVATED));
ASSERT_TRUE(IsOk(service_->markStagedSessionSuccessful(101)));
@@ -1405,9 +1409,9 @@
ASSERT_TRUE(IsOk(service_->stagePackages({installer.test_file})));
auto session = ApexSession::CreateSession(17239);
- ASSERT_TRUE(IsOk(session));
- ASSERT_TRUE(
- IsOk(session->UpdateStateAndCommit(SessionState::REVERT_IN_PROGRESS)));
+ ASSERT_RESULT_OK(session);
+ ASSERT_RESULT_OK(
+ session->UpdateStateAndCommit(SessionState::REVERT_IN_PROGRESS));
ASSERT_TRUE(IsOk(service_->resumeRevertIfNeeded()));
@@ -1438,14 +1442,14 @@
ASSERT_TRUE(IsOk(service_->stagePackages({installer.test_file})));
auto session = ApexSession::CreateSession(53);
- ASSERT_TRUE(IsOk(session));
- ASSERT_TRUE(IsOk(session->UpdateStateAndCommit(SessionState::SUCCESS)));
+ ASSERT_RESULT_OK(session);
+ ASSERT_RESULT_OK(session->UpdateStateAndCommit(SessionState::SUCCESS));
ASSERT_TRUE(IsOk(service_->resumeRevertIfNeeded()));
// Check that revert wasn't resumed.
auto active_pkgs = ReadEntireDir(kActiveApexPackagesDataDir);
- ASSERT_TRUE(IsOk(active_pkgs));
+ ASSERT_RESULT_OK(active_pkgs);
ASSERT_THAT(*active_pkgs,
UnorderedElementsAre(installer.test_installed_file));
@@ -1463,8 +1467,8 @@
}
auto session = ApexSession::CreateSession(53);
- ASSERT_TRUE(IsOk(session));
- ASSERT_TRUE(IsOk(session->UpdateStateAndCommit(SessionState::ACTIVATED)));
+ ASSERT_RESULT_OK(session);
+ ASSERT_RESULT_OK(session->UpdateStateAndCommit(SessionState::ACTIVATED));
ASSERT_FALSE(IsOk(service_->revertActiveSessions()));
ApexSessionInfo session_info;
@@ -1480,8 +1484,8 @@
}
auto session = ApexSession::CreateSession(17239);
- ASSERT_TRUE(IsOk(session));
- ASSERT_TRUE(IsOk(session->UpdateStateAndCommit(SessionState::REVERT_FAILED)));
+ ASSERT_RESULT_OK(session);
+ ASSERT_RESULT_OK(session->UpdateStateAndCommit(SessionState::REVERT_FAILED));
ASSERT_FALSE(IsOk(service_->revertActiveSessions()));
ApexSessionInfo session_info;