This source file includes following definitions.
- IN_PROC_BROWSER_TEST_F
- IN_PROC_BROWSER_TEST_F
#include "base/memory/scoped_vector.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/sessions_helper.h"
#include "chrome/browser/sync/test/integration/sync_test.h"
using sessions_helper::CheckForeignSessionsAgainst;
using sessions_helper::CheckInitialState;
using sessions_helper::OpenTabAndGetLocalWindows;
using sessions_helper::ScopedWindowMap;
using sessions_helper::SessionWindowMap;
using sessions_helper::SyncedSessionVector;
class MultipleClientSessionsSyncTest : public SyncTest {
public:
MultipleClientSessionsSyncTest() : SyncTest(MULTIPLE_CLIENT) {}
virtual ~MultipleClientSessionsSyncTest() {}
private:
DISALLOW_COPY_AND_ASSIGN(MultipleClientSessionsSyncTest);
};
#if defined(OS_WIN)
#define MAYBE_AllChanged DISABLED_AllChanged
#define MAYBE_EncryptedAndChanged DISABLED_EncryptedAndChanged
#else
#define MAYBE_AllChanged AllChanged
#define MAYBE_EncryptedAndChanged EncryptedAndChanged
#endif
IN_PROC_BROWSER_TEST_F(MultipleClientSessionsSyncTest, MAYBE_AllChanged) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
std::vector<ScopedWindowMap> client_windows(num_clients());
for (int i = 0; i < num_clients(); ++i) {
ASSERT_TRUE(CheckInitialState(i));
}
for (int i = 0; i < num_clients(); ++i) {
SessionWindowMap windows;
ASSERT_TRUE(OpenTabAndGetLocalWindows(
i, GURL(base::StringPrintf("http://127.0.0.1/bubba%i", i)), &windows));
client_windows[i].Reset(&windows);
}
ASSERT_TRUE(AwaitQuiescence());
for (int i = 0; i < num_clients(); ++i) {
ASSERT_TRUE(CheckForeignSessionsAgainst(i, client_windows));
}
}
IN_PROC_BROWSER_TEST_F(MultipleClientSessionsSyncTest,
MAYBE_EncryptedAndChanged) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
std::vector<ScopedWindowMap> client_windows(num_clients());
for (int i = 0; i < num_clients(); ++i) {
ASSERT_TRUE(CheckInitialState(i));
}
ASSERT_TRUE(EnableEncryption(0));
ASSERT_TRUE(GetClient(0)->AwaitGroupSyncCycleCompletion(clients()));
for (int i = 0; i < num_clients(); ++i) {
SessionWindowMap windows;
ASSERT_TRUE(OpenTabAndGetLocalWindows(
i, GURL(base::StringPrintf("http://127.0.0.1/bubba%i", i)), &windows));
client_windows[i].Reset(&windows);
}
ASSERT_TRUE(AwaitQuiescence());
for (int i = 0; i < num_clients(); ++i) {
ASSERT_TRUE(IsEncryptionComplete(i));
ASSERT_TRUE(CheckForeignSessionsAgainst(i, client_windows));
}
}