Commit d4eeaebb authored by Maksim Moskvitin's avatar Maksim Moskvitin Committed by Commit Bot

Reland "Rewrite sync tests to use custom passphrase logic"

This is a reland of 38ebe59c

The patch was reverted because of test flakiness, issue that introduced
flakiness fixed now.

Original change's description:
> Rewrite sync tests to use custom passphrase logic
>
> SingleClientUserEventsSyncTest.Encryption and
> TwoClientSessionsSyncTest.NoHistoryIfEncryptionEnabled used
> EnableEncryption(), which only works with Directory implementation of
> Nigori and outdated. They were rewritten to enable custom passphrase
> instead.
>
> Bug: 922900
> Change-Id: Ia5fedeae5b7c7071c1ecc82063e5742934caf2e0
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1890316
> Commit-Queue: Maksim Moskvitin <mmoskvitin@google.com>
> Commit-Queue: Mikel Astiz <mastiz@chromium.org>
> Auto-Submit: Maksim Moskvitin <mmoskvitin@google.com>
> Reviewed-by: Mikel Astiz <mastiz@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#710839}

Bug: 922900, 1020070
Change-Id: I7bd06fc272a615eebe0be60b93c7825e3cd13e0c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895344
Commit-Queue: Maksim Moskvitin <mmoskvitin@google.com>
Reviewed-by: default avatarMikel Astiz <mastiz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#712072}
parent 48282647
......@@ -182,15 +182,7 @@ IN_PROC_BROWSER_TEST_F(SingleClientUserEventsSyncTest, NoSessions) {
EXPECT_TRUE(ExpectUserEvents({specifics}));
}
// Flaky tests on ASan/TSan on linux: http://crbug.com/1020070
#if defined(OS_LINUX) && \
(defined(ADDRESS_SANITIZER) || defined(THREAD_SANITIZER))
#define MAYBE_Encryption DISABLED_Encryption
#else
#define MAYBE_Encryption Encryption
#endif
IN_PROC_BROWSER_TEST_F(SingleClientUserEventsSyncTest, MAYBE_Encryption) {
IN_PROC_BROWSER_TEST_F(SingleClientUserEventsSyncTest, Encryption) {
const UserEventSpecifics test_event1 =
CreateTestEvent(base::Time() + base::TimeDelta::FromMicroseconds(1));
const UserEventSpecifics test_event2 =
......@@ -201,7 +193,8 @@ IN_PROC_BROWSER_TEST_F(SingleClientUserEventsSyncTest, MAYBE_Encryption) {
browser_sync::UserEventServiceFactory::GetForProfile(GetProfile(0));
event_service->RecordUserEvent(test_event1);
EXPECT_TRUE(ExpectUserEvents({test_event1}));
ASSERT_TRUE(EnableEncryption(0));
GetSyncService(0)->GetUserSettings()->SetEncryptionPassphrase("passphrase");
ASSERT_TRUE(PassphraseAcceptedChecker(GetSyncService(0)).Wait());
event_service->RecordUserEvent(test_event2);
// Just checking that we don't see test_event2 isn't very convincing yet,
......
......@@ -9,6 +9,7 @@
#include "base/strings/stringprintf.h"
#include "build/build_config.h"
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sync/test/integration/encryption_helper.h"
#include "chrome/browser/sync/test/integration/passwords_helper.h"
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/sessions_helper.h"
......@@ -246,11 +247,12 @@ IN_PROC_BROWSER_TEST_F(TwoClientSessionsSyncTest,
ASSERT_TRUE(CheckInitialState(0));
ASSERT_TRUE(CheckInitialState(1));
ASSERT_TRUE(EnableEncryption(0));
ASSERT_TRUE(EnableEncryption(1));
ASSERT_TRUE(AwaitQuiescence());
ASSERT_TRUE(IsEncryptionComplete(0));
ASSERT_TRUE(IsEncryptionComplete(1));
GetSyncService(0)->GetUserSettings()->SetEncryptionPassphrase("passphrase");
ASSERT_TRUE(
PassphraseRequiredStateChecker(GetSyncService(1), /*desired_state=*/true)
.Wait());
ASSERT_TRUE(GetSyncService(1)->GetUserSettings()->SetDecryptionPassphrase(
"passphrase"));
EXPECT_TRUE(OpenTab(0, GURL(kURL1)));
WaitForForeignSessionsToSync(0, 1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment