From bf67782e0f7ea9fe1b209557b929088b5a7dcfae Mon Sep 17 00:00:00 2001 From: AlexeyBarabash Date: Fri, 15 Apr 2022 22:00:16 +0300 Subject: [PATCH] Addressed codereview suggestions: - updated comments - removed forgotten include - used base::StrCat - redone TimeLimitedWords::Validate => TimeLimitedWords::Parse to avoid using of output string* parameter - fixed ret.pure_words initialization - removed forgotten log - from js and html changes combined variables isInvalidSyncCode and syncCodeValidationResult into single syncCodeValidationError Adjusted words epoch and v1 sunset dates - epoch to Tue, 10 May 2022 - sunset to Fri, 1 Jul --- browser/android/brave_sync_worker.cc | 20 ++-- .../brave_sync_code_dialog.html | 4 +- .../brave_sync_page/brave_sync_code_dialog.js | 12 +-- .../brave_sync_page/brave_sync_setup.html | 3 +- .../brave_sync_page/brave_sync_setup.js | 13 +-- .../ui/webui/settings/brave_sync_handler.cc | 53 ++++++----- components/brave_sync/time_limited_words.cc | 55 ++++++++--- components/brave_sync/time_limited_words.h | 28 ++++-- .../brave_sync/time_limited_words_unittest.cc | 94 ++++++++++--------- 9 files changed, 156 insertions(+), 126 deletions(-) diff --git a/browser/android/brave_sync_worker.cc b/browser/android/brave_sync_worker.cc index dcd266acb512..ef8f33b05c84 100644 --- a/browser/android/brave_sync_worker.cc +++ b/browser/android/brave_sync_worker.cc @@ -358,9 +358,11 @@ int JNI_BraveSyncWorker_GetWordsValidationResult( std::string str_time_limited_words = base::android::ConvertJavaStringToUTF8(time_limited_words); DCHECK(!str_time_limited_words.empty()); - std::string pure_words_stub; - return static_cast(brave_sync::TimeLimitedWords::Validate( - str_time_limited_words, &pure_words_stub)); + + auto pure_words_with_status = + brave_sync::TimeLimitedWords::Parse(str_time_limited_words); + + return static_cast(pure_words_with_status.status); } static base::android::ScopedJavaLocalRef @@ -371,12 +373,14 @@ JNI_BraveSyncWorker_GetPureWordsFromTimeLimited( base::android::ConvertJavaStringToUTF8(time_limited_words); DCHECK(!str_time_limited_words.empty()); - std::string pure_words; - auto validation_result = brave_sync::TimeLimitedWords::Validate( - str_time_limited_words, &pure_words); - DCHECK_EQ(validation_result, brave_sync::WordsValidationResult::kValid); + auto pure_words_with_status = + brave_sync::TimeLimitedWords::Parse(str_time_limited_words); + DCHECK_EQ(pure_words_with_status.status, + brave_sync::WordsValidationStatus::kValid); + DCHECK(pure_words_with_status.pure_words.has_value()); - return base::android::ConvertUTF8ToJavaString(env, pure_words); + return base::android::ConvertUTF8ToJavaString( + env, pure_words_with_status.pure_words.value()); } static base::android::ScopedJavaLocalRef diff --git a/browser/resources/settings/brave_sync_page/brave_sync_code_dialog.html b/browser/resources/settings/brave_sync_page/brave_sync_code_dialog.html index 5585c3cc7a72..f78299cc74b9 100644 --- a/browser/resources/settings/brave_sync_page/brave_sync_code_dialog.html +++ b/browser/resources/settings/brave_sync_page/brave_sync_code_dialog.html @@ -334,9 +334,9 @@

$i18n{braveSyncChooseDeviceComputerTitle}

- diff --git a/browser/resources/settings/brave_sync_page/brave_sync_setup.js b/browser/resources/settings/brave_sync_page/brave_sync_setup.js index 32536c8e6b69..8a478c22d9c7 100644 --- a/browser/resources/settings/brave_sync_page/brave_sync_setup.js +++ b/browser/resources/settings/brave_sync_page/brave_sync_setup.js @@ -43,11 +43,7 @@ Polymer({ type: Boolean, value: false, }, - isInvalidSyncCode_: { - type: Boolean, - value: false, - }, - syncCodeValidationResult_: { + syncCodeValidationError_: { type: String, value: '', } @@ -86,20 +82,17 @@ Polymer({ }, submitSyncCode_: async function () { - console.log('submitSyncCode_ 000') this.isSubmittingSyncCode_ = true const syncCodeToSubmit = this.syncCode || '' let success = false try { success = await this.syncBrowserProxy_.setSyncCode(syncCodeToSubmit) } catch (e) { - this.syncCodeValidationResult_ = e + this.syncCodeValidationError_ = e success = false } this.isSubmittingSyncCode_ = false - if (!success) { - this.isInvalidSyncCode_ = true - } else { + if (success) { this.syncCodeDialogType_ = undefined this.fire('setup-success') } diff --git a/browser/ui/webui/settings/brave_sync_handler.cc b/browser/ui/webui/settings/brave_sync_handler.cc index a8e176a92094..b2c463ddf6b4 100644 --- a/browser/ui/webui/settings/brave_sync_handler.cc +++ b/browser/ui/webui/settings/brave_sync_handler.cc @@ -31,24 +31,24 @@ #include "ui/base/webui/web_ui_util.h" using brave_sync::TimeLimitedWords; -using brave_sync::WordsValidationResult; +using brave_sync::WordsValidationStatus; namespace { std::string GetSyncCodeValidationString( - WordsValidationResult validation_result) { + WordsValidationStatus validation_result) { switch (validation_result) { - case WordsValidationResult::kValid: + case WordsValidationStatus::kValid: return ""; - case WordsValidationResult::kWrongWordsNumber: - case WordsValidationResult::kNotValidPureWords: + case WordsValidationStatus::kWrongWordsNumber: + case WordsValidationStatus::kNotValidPureWords: return l10n_util::GetStringUTF8(IDS_BRAVE_SYNC_CODE_INVALID); - case WordsValidationResult::kVersionDeprecated: + case WordsValidationStatus::kVersionDeprecated: return l10n_util::GetStringUTF8( IDS_BRAVE_SYNC_CODE_FROM_DEPRECATED_VERSION); - case WordsValidationResult::kExpired: + case WordsValidationStatus::kExpired: return l10n_util::GetStringUTF8(IDS_BRAVE_SYNC_CODE_EXPIRED); - case WordsValidationResult::kValidForTooLong: + case WordsValidationStatus::kValidForTooLong: return l10n_util::GetStringUTF8(IDS_BRAVE_SYNC_CODE_VALID_FOR_TOO_LONG); default: NOTREACHED(); @@ -152,15 +152,15 @@ void BraveSyncHandler::HandleGetQRCode(const base::Value::List& args) { const std::string time_limited_sync_code = args[1].GetString(); // Sync code arrives here with time-limit 25th word, remove it to get proper - // pure seed for QR generation - std::string pure_sync_code; - auto validation_result = - TimeLimitedWords::Validate(time_limited_sync_code, &pure_sync_code); - CHECK_EQ(validation_result, WordsValidationResult::kValid); - CHECK_NE(pure_sync_code.size(), 0u); + // pure seed for QR generation (QR codes have their own expiry) + auto pure_words_with_status = TimeLimitedWords::Parse(time_limited_sync_code); + CHECK_EQ(pure_words_with_status.status, WordsValidationStatus::kValid); + CHECK(pure_words_with_status.pure_words); + CHECK_NE(pure_words_with_status.pure_words.value().size(), 0u); std::vector seed; - if (!brave_sync::crypto::PassphraseToBytes32(pure_sync_code, &seed)) { + if (!brave_sync::crypto::PassphraseToBytes32( + pure_words_with_status.pure_words.value(), &seed)) { LOG(ERROR) << "invalid sync code when generating qr code"; RejectJavascriptCallback(args[0].Clone(), base::Value("invalid sync code")); return; @@ -211,23 +211,24 @@ void BraveSyncHandler::HandleSetSyncCode(const base::Value::List& args) { return; } - std::string pure_sync_code; - WordsValidationResult validation_result = - TimeLimitedWords::Validate(time_limited_sync_code, &pure_sync_code); - if (validation_result != WordsValidationResult::kValid) { + auto pure_words_with_status = TimeLimitedWords::Parse(time_limited_sync_code); + + if (pure_words_with_status.status != WordsValidationStatus::kValid) { LOG(ERROR) << "Could not validate a sync code, validation_result=" - << static_cast(validation_result) << " " - << GetSyncCodeValidationString(validation_result); - RejectJavascriptCallback( - args[0].Clone(), - base::Value(GetSyncCodeValidationString(validation_result))); + << static_cast(pure_words_with_status.status) << " " + << GetSyncCodeValidationString(pure_words_with_status.status); + RejectJavascriptCallback(args[0].Clone(), + base::Value(GetSyncCodeValidationString( + pure_words_with_status.status))); return; } - CHECK(!pure_sync_code.empty()); + CHECK(pure_words_with_status.pure_words); + CHECK(!pure_words_with_status.pure_words.value().empty()); auto* sync_service = GetSyncService(); - if (!sync_service || !sync_service->SetSyncCode(pure_sync_code)) { + if (!sync_service || + !sync_service->SetSyncCode(pure_words_with_status.pure_words.value())) { RejectJavascriptCallback(args[0].Clone(), base::Value(false)); return; } diff --git a/components/brave_sync/time_limited_words.cc b/components/brave_sync/time_limited_words.cc index 67ad35f733a4..23fecbdd5122 100644 --- a/components/brave_sync/time_limited_words.cc +++ b/components/brave_sync/time_limited_words.cc @@ -12,6 +12,7 @@ #include "base/containers/span.h" #include "base/logging.h" #include "base/notreached.h" +#include "base/strings/strcat.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" #include "base/time/time.h" @@ -23,13 +24,22 @@ namespace brave_sync { namespace { -// TODO(alexeybarabash): subject to change -static constexpr char kWordsv1SunsetDate[] = "Wed, 1 Jun 2022 00:00:00 GMT"; - -static constexpr char kWordsv2Epoch[] = "Fri, 15 Apr 2022 00:00:00 GMT"; +static constexpr char kWordsv1SunsetDate[] = "Fri, 1 Jul 2022 00:00:00 GMT"; +static constexpr char kWordsv2Epoch[] = "Tue, 10 May 2022 00:00:00 GMT"; } // namespace +TimeLimitedWords::PureWordsWithStatus::PureWordsWithStatus() = default; + +TimeLimitedWords::PureWordsWithStatus::PureWordsWithStatus( + PureWordsWithStatus&& other) = default; + +TimeLimitedWords::PureWordsWithStatus::~PureWordsWithStatus() = default; + +TimeLimitedWords::PureWordsWithStatus& +TimeLimitedWords::PureWordsWithStatus::operator=(PureWordsWithStatus&& other) = + default; + using base::Time; using base::TimeDelta; @@ -117,11 +127,11 @@ std::string TimeLimitedWords::GenerateForDate(const std::string& pure_words, std::string last_word = GetWordByIndex(days_since_words_v2_epoch); - std::string time_limited_code = pure_words + " " + last_word; + std::string time_limited_code = base::StrCat({pure_words, " ", last_word}); return time_limited_code; } -WordsValidationResult TimeLimitedWords::Validate( +WordsValidationStatus TimeLimitedWords::Validate( const std::string& time_limited_words, std::string* pure_words) { CHECK_NE(pure_words, nullptr); @@ -144,12 +154,12 @@ WordsValidationResult TimeLimitedWords::Validate( base::span(words.begin(), kPureWordsCount), " "); if (crypto::IsPassphraseValid(recombined_pure_words)) { *pure_words = recombined_pure_words; - return WordsValidationResult::kValid; + return WordsValidationStatus::kValid; } else { - return WordsValidationResult::kNotValidPureWords; + return WordsValidationStatus::kNotValidPureWords; } } else { - return WordsValidationResult::kVersionDeprecated; + return WordsValidationStatus::kVersionDeprecated; } } else if (num_words == kWordsV2Count) { std::string recombined_pure_words = base::JoinString( @@ -164,21 +174,36 @@ WordsValidationResult TimeLimitedWords::Validate( int days_abs_diff = std::abs(days_actual - days_encoded); if (days_abs_diff <= 1) { *pure_words = recombined_pure_words; - return WordsValidationResult::kValid; + return WordsValidationStatus::kValid; } else if (days_actual > days_encoded) { - return WordsValidationResult::kExpired; + return WordsValidationStatus::kExpired; } else if (days_encoded > days_actual) { - return WordsValidationResult::kValidForTooLong; + return WordsValidationStatus::kValidForTooLong; } } else { - return WordsValidationResult::kNotValidPureWords; + return WordsValidationStatus::kNotValidPureWords; } } else { - return WordsValidationResult::kWrongWordsNumber; + return WordsValidationStatus::kWrongWordsNumber; } NOTREACHED(); - return WordsValidationResult::kNotValidPureWords; + return WordsValidationStatus::kNotValidPureWords; +} + +TimeLimitedWords::PureWordsWithStatus TimeLimitedWords::Parse( + const std::string& time_limited_words) { + PureWordsWithStatus ret; + std::string pure_words; + ret.status = Validate(time_limited_words, &pure_words); + + if (ret.status == WordsValidationStatus::kValid) { + ret.pure_words = pure_words; + } else { + ret.pure_words = absl::nullopt; + } + + return ret; } } // namespace brave_sync diff --git a/components/brave_sync/time_limited_words.h b/components/brave_sync/time_limited_words.h index cafca393ad51..87515e7e33ec 100644 --- a/components/brave_sync/time_limited_words.h +++ b/components/brave_sync/time_limited_words.h @@ -11,10 +11,11 @@ #include "base/gtest_prod_util.h" #include "base/time/time.h" +#include "third_party/abseil-cpp/absl/types/optional.h" namespace brave_sync { -enum class WordsValidationResult { +enum class WordsValidationStatus { kValid = 0, kNotValidPureWords = 1, kVersionDeprecated = 2, @@ -27,14 +28,26 @@ FORWARD_DECLARE_TEST(TimeLimitedWordsTest, GenerateForDate); FORWARD_DECLARE_TEST(TimeLimitedWordsTest, GetIndexByWord); FORWARD_DECLARE_TEST(TimeLimitedWordsTest, GetRoundedDaysDiff); FORWARD_DECLARE_TEST(TimeLimitedWordsTest, GetWordByIndex); -FORWARD_DECLARE_TEST(TimeLimitedWordsTest, Validate); +FORWARD_DECLARE_TEST(TimeLimitedWordsTest, Parse); class TimeLimitedWords { public: - static std::string GenerateForNow(const std::string& pure_words); + struct PureWordsWithStatus { + PureWordsWithStatus(); + PureWordsWithStatus(PureWordsWithStatus&& other); + PureWordsWithStatus& operator=(PureWordsWithStatus&& other); - static WordsValidationResult Validate(const std::string& time_limited_words, - std::string* pure_words); + PureWordsWithStatus(const PureWordsWithStatus&) = delete; + PureWordsWithStatus& operator=(const PureWordsWithStatus&) = delete; + + ~PureWordsWithStatus(); + + absl::optional pure_words; + WordsValidationStatus status; + }; + + static std::string GenerateForNow(const std::string& pure_words); + static PureWordsWithStatus Parse(const std::string& time_limited_words); static base::Time GetWordsV1SunsetDay(); static base::Time GetWordsV2Epoch(); @@ -44,7 +57,10 @@ class TimeLimitedWords { FRIEND_TEST_ALL_PREFIXES(TimeLimitedWordsTest, GetIndexByWord); FRIEND_TEST_ALL_PREFIXES(TimeLimitedWordsTest, GetRoundedDaysDiff); FRIEND_TEST_ALL_PREFIXES(TimeLimitedWordsTest, GetWordByIndex); - FRIEND_TEST_ALL_PREFIXES(TimeLimitedWordsTest, Validate); + FRIEND_TEST_ALL_PREFIXES(TimeLimitedWordsTest, Parse); + + static WordsValidationStatus Validate(const std::string& time_limited_words, + std::string* pure_words); static std::string GenerateForDate(const std::string& pure_words, const base::Time& not_after); diff --git a/components/brave_sync/time_limited_words_unittest.cc b/components/brave_sync/time_limited_words_unittest.cc index c1f302293de8..e9c629ff2138 100644 --- a/components/brave_sync/time_limited_words_unittest.cc +++ b/components/brave_sync/time_limited_words_unittest.cc @@ -7,8 +7,7 @@ #include -#include "base/logging.h" -#include "base/test/gtest_util.h" +#include "base/strings/strcat.h" #include "base/time/time_override.h" #include "testing/gtest/include/gtest/gtest.h" @@ -62,11 +61,11 @@ TEST(TimeLimitedWordsTest, GetWordByIndex) { } TEST(TimeLimitedWordsTest, GenerateForDate) { - EXPECT_EQ(std::string(kValidSyncCode) + " abandon", + EXPECT_EQ(base::StrCat({kValidSyncCode, " abandon"}), TimeLimitedWords::GenerateForDate( kValidSyncCode, TimeLimitedWords::GetWordsV2Epoch())); EXPECT_EQ( - std::string(kValidSyncCode) + " ability", + base::StrCat({kValidSyncCode, " ability"}), TimeLimitedWords::GenerateForDate( kValidSyncCode, TimeLimitedWords::GetWordsV2Epoch() + base::Days(1))); EXPECT_EQ("", TimeLimitedWords::GenerateForDate( @@ -74,36 +73,37 @@ TEST(TimeLimitedWordsTest, GenerateForDate) { TimeLimitedWords::GetWordsV2Epoch() - base::Days(1))); } -TEST(TimeLimitedWordsTest, Validate) { +TEST(TimeLimitedWordsTest, Parse) { std::string pure_words; - WordsValidationResult result; + TimeLimitedWords::PureWordsWithStatus pure_words_with_status; { // Valid v1 sync code, prior to sunset date auto time_override = OverrideWithTimeNow( TimeLimitedWords::GetWordsV1SunsetDay() - base::Days(1)); - result = TimeLimitedWords::Validate(kValidSyncCode, &pure_words); - EXPECT_EQ(result, WordsValidationResult::kValid); - EXPECT_EQ(pure_words, kValidSyncCode); + pure_words_with_status = TimeLimitedWords::Parse(kValidSyncCode); + EXPECT_EQ(pure_words_with_status.status, WordsValidationStatus::kValid); + EXPECT_EQ(pure_words_with_status.pure_words.value(), kValidSyncCode); } { // Valid v1 sync code plus ending space, prior to sunset date auto time_override = OverrideWithTimeNow( TimeLimitedWords::GetWordsV1SunsetDay() - base::Days(1)); - result = TimeLimitedWords::Validate(kValidSyncCode + std::string(" "), - &pure_words); - EXPECT_EQ(result, WordsValidationResult::kValid); - EXPECT_EQ(pure_words, kValidSyncCode); + pure_words_with_status = + TimeLimitedWords::Parse(base::StrCat({kValidSyncCode, " "})); + EXPECT_EQ(pure_words_with_status.status, WordsValidationStatus::kValid); + EXPECT_EQ(pure_words_with_status.pure_words.value(), kValidSyncCode); } { // Invalid v1 sync code, prior to sunset date auto time_override = OverrideWithTimeNow( TimeLimitedWords::GetWordsV1SunsetDay() - base::Days(1)); - result = TimeLimitedWords::Validate(kInvalidSyncCode, &pure_words); - EXPECT_EQ(result, WordsValidationResult::kNotValidPureWords); - EXPECT_EQ(pure_words, ""); + pure_words_with_status = TimeLimitedWords::Parse(kInvalidSyncCode); + EXPECT_EQ(pure_words_with_status.status, + WordsValidationStatus::kNotValidPureWords); + EXPECT_FALSE(pure_words_with_status.pure_words.has_value()); } const base::Time anchorDayForWordsV2 = @@ -111,14 +111,14 @@ TEST(TimeLimitedWordsTest, Validate) { const std::string valid25thAnchoredWord = TimeLimitedWords::GetWordByIndex(20); const std::string valid25thAnchoredWords = - kValidSyncCode + std::string(" ") + valid25thAnchoredWord; + base::StrCat({kValidSyncCode, " ", valid25thAnchoredWord}); { // Valid v2 sync code, after sunset date, around anchored day auto time_override = OverrideWithTimeNow(anchorDayForWordsV2); - result = TimeLimitedWords::Validate(valid25thAnchoredWords, &pure_words); - EXPECT_EQ(result, WordsValidationResult::kValid); - EXPECT_EQ(pure_words, kValidSyncCode); + pure_words_with_status = TimeLimitedWords::Parse(valid25thAnchoredWords); + EXPECT_EQ(pure_words_with_status.status, WordsValidationStatus::kValid); + EXPECT_EQ(pure_words_with_status.pure_words.value(), kValidSyncCode); } { @@ -126,12 +126,12 @@ TEST(TimeLimitedWordsTest, Validate) { const std::string valid25thExpiredWord = TimeLimitedWords::GetWordByIndex(15); const std::string valid25thExpiredWords = - kValidSyncCode + std::string(" ") + valid25thExpiredWord; + base::StrCat({kValidSyncCode, " ", valid25thExpiredWord}); auto time_override = OverrideWithTimeNow(anchorDayForWordsV2); - result = TimeLimitedWords::Validate(valid25thExpiredWords, &pure_words); - EXPECT_EQ(result, WordsValidationResult::kExpired); - EXPECT_EQ(pure_words, ""); + pure_words_with_status = TimeLimitedWords::Parse(valid25thExpiredWords); + EXPECT_EQ(pure_words_with_status.status, WordsValidationStatus::kExpired); + EXPECT_FALSE(pure_words_with_status.pure_words.has_value()); } { @@ -139,46 +139,48 @@ TEST(TimeLimitedWordsTest, Validate) { const std::string valid25thValidTooLongWord = TimeLimitedWords::GetWordByIndex(25); const std::string valid25thValidTooLongWords = - kValidSyncCode + std::string(" ") + valid25thValidTooLongWord; + base::StrCat({kValidSyncCode, " ", valid25thValidTooLongWord}); auto time_override = OverrideWithTimeNow(anchorDayForWordsV2); - result = - TimeLimitedWords::Validate(valid25thValidTooLongWords, &pure_words); - EXPECT_EQ(result, WordsValidationResult::kValidForTooLong); - EXPECT_EQ(pure_words, ""); + pure_words_with_status = + TimeLimitedWords::Parse(valid25thValidTooLongWords); + EXPECT_EQ(pure_words_with_status.status, + WordsValidationStatus::kValidForTooLong); + EXPECT_FALSE(pure_words_with_status.pure_words.has_value()); } { // Wrong words number auto time_override = OverrideWithTimeNow(anchorDayForWordsV2); - result = TimeLimitedWords::Validate("abandon ability", &pure_words); - EXPECT_EQ(result, WordsValidationResult::kWrongWordsNumber); - EXPECT_EQ(pure_words, ""); - - result = TimeLimitedWords::Validate( - valid25thAnchoredWords + " abandon ability", &pure_words); - EXPECT_EQ(result, WordsValidationResult::kWrongWordsNumber); - EXPECT_EQ(pure_words, ""); + pure_words_with_status = TimeLimitedWords::Parse("abandon ability"); + EXPECT_EQ(pure_words_with_status.status, + WordsValidationStatus::kWrongWordsNumber); + EXPECT_FALSE(pure_words_with_status.pure_words.has_value()); + + pure_words_with_status = TimeLimitedWords::Parse( + base::StrCat({valid25thAnchoredWords, " abandon ability"})); + EXPECT_EQ(pure_words_with_status.status, + WordsValidationStatus::kWrongWordsNumber); + EXPECT_FALSE(pure_words_with_status.pure_words.has_value()); } { // Valid v2 sync code, after sunset date, day modulo 2048 which is - // "2027-08-11 00:00:00.000 UTC" + // "2027-11-23 00:00:00.000 UTC" + // Note: While this date is way too far into the future, the codes repeat + // after a few years and so this becomes valid again, an unfortunate + // limitation of this scheme. const std::string validModulo2048Word = TimeLimitedWords::GetWordByIndex(2048); const std::string validModulo2048Words = - kValidSyncCode + std::string(" ") + validModulo2048Word; + base::StrCat({kValidSyncCode, " ", validModulo2048Word}); auto time_override = OverrideWithTimeNow( TimeLimitedWords::GetWordsV2Epoch() + base::Days(2048)); - result = TimeLimitedWords::Validate(validModulo2048Words, &pure_words); - EXPECT_EQ(result, WordsValidationResult::kValid); - EXPECT_EQ(pure_words, kValidSyncCode); + pure_words_with_status = TimeLimitedWords::Parse(validModulo2048Words); + EXPECT_EQ(pure_words_with_status.status, WordsValidationStatus::kValid); + EXPECT_EQ(pure_words_with_status.pure_words.value(), kValidSyncCode); } } -TEST(TimeLimitedWordsDeathTest, ValidateCheckWithNullptr) { - EXPECT_CHECK_DEATH(TimeLimitedWords::Validate("abandon ability", nullptr)); -} - } // namespace brave_sync