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

Unified Diff: chrome/test/live_sync/live_sessions_sync_test.cc

Issue 7575026: Session/tab sync performance tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unneeded variables used by disabled test Created 9 years, 4 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/test/live_sync/live_sessions_sync_test.cc
diff --git a/chrome/test/live_sync/live_sessions_sync_test.cc b/chrome/test/live_sync/live_sessions_sync_test.cc
index b72363fc41434a4403b8d16bce1713673e917782..888de01f25ae61106697eba7cff7591d1d09bea7 100644
--- a/chrome/test/live_sync/live_sessions_sync_test.cc
+++ b/chrome/test/live_sync/live_sessions_sync_test.cc
@@ -89,27 +89,49 @@ bool LiveSessionsSyncTest::ModelAssociatorHasTabWithUrl(int index,
}
bool LiveSessionsSyncTest::OpenTab(int index, const GURL& url) {
- static const int timeout_milli = TestTimeouts::action_max_timeout_ms();
VLOG(1) << "Opening tab: " << url.spec();
GetBrowser(index)->ShowSingletonTab(url);
+ return WaitForTabsToLoad(index, std::vector<GURL>(1, url));
+}
+
+bool LiveSessionsSyncTest::OpenMultipleTabs(int index,
+ const std::vector<GURL>& urls) {
+ Browser* browser = GetBrowser(index);
+ for (std::vector<GURL>::const_iterator it = urls.begin();
+ it != urls.end(); ++it) {
+ VLOG(1) << "Opening tab: " << it->spec();
Raghu Simha 2011/08/05 21:26:07 How about: "Opening tab: " << it->spec() << " usin
braffert 2011/08/05 21:37:21 Done.
+ browser->ShowSingletonTab(*it);
+ }
+ return WaitForTabsToLoad(index, urls);
+}
+
+bool LiveSessionsSyncTest::WaitForTabsToLoad(
+ int index, const std::vector<GURL>& urls) {
VLOG(1) << "Waiting for session to propagate to associator.";
+ static const int timeout_milli = TestTimeouts::action_max_timeout_ms();
base::TimeTicks start_time = base::TimeTicks::Now();
base::TimeTicks end_time = start_time +
base::TimeDelta::FromMilliseconds(timeout_milli);
- do {
- if (ModelAssociatorHasTabWithUrl(index, url))
- return true;
- GetProfile(index)->GetProfileSyncService()->GetSessionModelAssociator()->
- BlockUntilLocalChangeForTest(timeout_milli);
- ui_test_utils::RunMessageLoop();
- } while (base::TimeTicks::Now() < end_time);
-
- if (ModelAssociatorHasTabWithUrl(index, url))
- return true;
-
- LOG(ERROR) << "Failed to find tab after " << timeout_milli/1000.0
- << " seconds.";
- return false;
+ bool found;
+ for (std::vector<GURL>::const_iterator it = urls.begin();
+ it != urls.end(); ++it) {
+ found = false;
+ while (!found) {
+ found = ModelAssociatorHasTabWithUrl(index, *it);
Raghu Simha 2011/08/05 21:26:07 Curious: What if found becomes true at the last po
braffert 2011/08/05 21:37:21 I don't think it's anything to be concerned with.
Nicolas Zea 2011/08/05 21:40:41 There's nothing we can do about it turning true af
+ if (base::TimeTicks::Now() >= end_time) {
+ LOG(ERROR) << "Failed to find all tabs after " << timeout_milli/1000.0
+ << " seconds.";
+ return false;
+ }
+ if (!found) {
+ GetProfile(index)->GetProfileSyncService()->
+ GetSessionModelAssociator()->
+ BlockUntilLocalChangeForTest(timeout_milli);
+ ui_test_utils::RunMessageLoop();
+ }
+ }
+ }
+ return true;
}
std::vector<SessionWindow*>* LiveSessionsSyncTest::GetLocalWindows(int index) {

Powered by Google App Engine
This is Rietveld 408576698