Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2834)

Unified Diff: chrome/browser/sync/test/integration/sessions_helper.cc

Issue 2379433002: [Sync] Refactoring of sync integration test checkers to remove boilerplate await methods. (Closed)
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/test/integration/sessions_helper.cc
diff --git a/chrome/browser/sync/test/integration/sessions_helper.cc b/chrome/browser/sync/test/integration/sessions_helper.cc
index 8099dac6ac905bc4929658bdc38be897ffbdedaf..98e0936e214d9914a5802d3d8427b0ce63d44bab 100644
--- a/chrome/browser/sync/test/integration/sessions_helper.cc
+++ b/chrome/browser/sync/test/integration/sessions_helper.cc
@@ -21,7 +21,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/sync/sessions/notification_service_sessions_router.h"
-#include "chrome/browser/sync/test/integration/multi_client_status_change_checker.h"
#include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
#include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
#include "chrome/browser/ui/singleton_tabs.h"
@@ -377,53 +376,27 @@ bool CheckForeignSessionsAgainst(
return true;
}
-namespace {
-
-// Helper class used in the implementation of AwaitCheckForeignSessionsAgainst.
-class CheckForeignSessionsChecker : public MultiClientStatusChangeChecker {
- public:
- CheckForeignSessionsChecker(int index,
- const std::vector<ScopedWindowMap>& windows);
- ~CheckForeignSessionsChecker() override;
-
- bool IsExitConditionSatisfied() override;
- std::string GetDebugMessage() const override;
+void DeleteForeignSession(int index, std::string session_tag) {
+ ProfileSyncServiceFactory::GetInstance()
+ ->GetForProfile(test()->GetProfile(index))
+ ->GetOpenTabsUIDelegate()
+ ->DeleteForeignSession(session_tag);
+}
- private:
- int index_;
- const std::vector<ScopedWindowMap>& windows_;
-};
+} // namespace sessions_helper
-CheckForeignSessionsChecker::CheckForeignSessionsChecker(
- int index, const std::vector<ScopedWindowMap>& windows)
+ForeignSessionsMatchChecker::ForeignSessionsMatchChecker(
+ int index,
+ const std::vector<sessions_helper::ScopedWindowMap>& windows)
: MultiClientStatusChangeChecker(
- sync_datatype_helper::test()->GetSyncServices()),
+ sync_datatype_helper::test()->GetSyncServices()),
index_(index),
windows_(windows) {}
-CheckForeignSessionsChecker::~CheckForeignSessionsChecker() {}
-
-bool CheckForeignSessionsChecker::IsExitConditionSatisfied() {
- return CheckForeignSessionsAgainst(index_, windows_);
+bool ForeignSessionsMatchChecker::IsExitConditionSatisfied() {
+ return sessions_helper::CheckForeignSessionsAgainst(index_, windows_);
}
-std::string CheckForeignSessionsChecker::GetDebugMessage() const {
+std::string ForeignSessionsMatchChecker::GetDebugMessage() const {
return "Waiting for matching foreign sessions";
}
-
-} // namespace
-
-bool AwaitCheckForeignSessionsAgainst(
- int index, const std::vector<ScopedWindowMap>& windows) {
- CheckForeignSessionsChecker checker(index, windows);
- checker.Wait();
- return !checker.TimedOut();
-}
-
-void DeleteForeignSession(int index, std::string session_tag) {
- ProfileSyncServiceFactory::GetInstance()->GetForProfile(
- test()->GetProfile(index))->
- GetOpenTabsUIDelegate()->DeleteForeignSession(session_tag);
-}
-
-} // namespace sessions_helper

Powered by Google App Engine
This is Rietveld 408576698