BookmarkManager: Fix 'new folder text field size changes on clicking it' issue.
[chromium-blink-merge.git] / chrome / browser / sync / test / integration / performance / sync_timing_helper.cc
blobd5f46e64324c7fb3fbf10d07413bb16179cd472f
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/sync/test/integration/performance/sync_timing_helper.h"
7 #include "base/strings/string_number_conversions.h"
8 #include "base/time/time.h"
9 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
10 #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 using sync_integration_test_util::AwaitCommitActivityCompletion;
15 SyncTimingHelper::SyncTimingHelper() {}
17 SyncTimingHelper::~SyncTimingHelper() {}
19 // static
20 base::TimeDelta SyncTimingHelper::TimeSyncCycle(
21 ProfileSyncServiceHarness* client) {
22 base::Time start = base::Time::Now();
23 EXPECT_TRUE(AwaitCommitActivityCompletion(client->service()));
24 return base::Time::Now() - start;
27 // static
28 base::TimeDelta SyncTimingHelper::TimeMutualSyncCycle(
29 ProfileSyncServiceHarness* client, ProfileSyncServiceHarness* partner) {
30 base::Time start = base::Time::Now();
31 EXPECT_TRUE(client->AwaitMutualSyncCycleCompletion(partner));
32 return base::Time::Now() - start;
35 // static
36 base::TimeDelta SyncTimingHelper::TimeUntilQuiescence(
37 std::vector<ProfileSyncServiceHarness*>& clients) {
38 base::Time start = base::Time::Now();
39 EXPECT_TRUE(ProfileSyncServiceHarness::AwaitQuiescence(clients));
40 return base::Time::Now() - start;
43 // static
44 void SyncTimingHelper::PrintResult(const std::string& measurement,
45 const std::string& trace,
46 const base::TimeDelta& dt) {
47 printf("*RESULT %s: %s= %s ms\n", measurement.c_str(), trace.c_str(),
48 base::Int64ToString(dt.InMilliseconds()).c_str());