| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "base/strings/stringprintf.h" | 6 #include "base/strings/stringprintf.h" |
| 7 #include "chrome/browser/sync/test/integration/performance/sync_timing_helper.h" | 7 #include "chrome/browser/sync/test/integration/performance/sync_timing_helper.h" |
| 8 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" | 8 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" |
| 9 #include "chrome/browser/sync/test/integration/sessions_helper.h" | 9 #include "chrome/browser/sync/test/integration/sessions_helper.h" |
| 10 #include "chrome/browser/sync/test/integration/sync_test.h" | 10 #include "chrome/browser/sync/test/integration/sync_test.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_commands.h" | 12 #include "chrome/browser/ui/browser_commands.h" |
| 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 14 | 14 |
| 15 using content::OpenURLParams; | 15 using content::OpenURLParams; |
| 16 using sessions_helper::GetLocalSession; | 16 using sessions_helper::GetLocalSession; |
| 17 using sessions_helper::GetSessionData; | 17 using sessions_helper::GetSessionData; |
| 18 using sessions_helper::OpenMultipleTabs; | 18 using sessions_helper::OpenMultipleTabs; |
| 19 using sessions_helper::SyncedSessionVector; | 19 using sessions_helper::SyncedSessionVector; |
| 20 using sessions_helper::SessionWindowMap; | 20 using sessions_helper::SessionWindowMap; |
| 21 using sessions_helper::WaitForTabsToLoad; | 21 using sessions_helper::WaitForTabsToLoad; |
| 22 using sync_timing_helper::PrintResult; |
| 23 using sync_timing_helper::TimeMutualSyncCycle; |
| 22 | 24 |
| 23 static const int kNumTabs = 150; | 25 static const int kNumTabs = 150; |
| 24 | 26 |
| 25 class SessionsSyncPerfTest: public SyncTest { | 27 class SessionsSyncPerfTest: public SyncTest { |
| 26 public: | 28 public: |
| 27 SessionsSyncPerfTest() : SyncTest(TWO_CLIENT), url_number_(0) {} | 29 SessionsSyncPerfTest() : SyncTest(TWO_CLIENT), url_number_(0) {} |
| 28 | 30 |
| 29 // Opens |num_tabs| new tabs on |profile|. | 31 // Opens |num_tabs| new tabs on |profile|. |
| 30 void AddTabs(int profile, int num_tabs); | 32 void AddTabs(int profile, int num_tabs); |
| 31 | 33 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 109 |
| 108 GURL SessionsSyncPerfTest::IntToURL(int n) { | 110 GURL SessionsSyncPerfTest::IntToURL(int n) { |
| 109 return GURL(base::StringPrintf("http://localhost/%d", n)); | 111 return GURL(base::StringPrintf("http://localhost/%d", n)); |
| 110 } | 112 } |
| 111 | 113 |
| 112 // TODO(lipalani): Re-enable after crbug.com/96921 is fixed. | 114 // TODO(lipalani): Re-enable after crbug.com/96921 is fixed. |
| 113 IN_PROC_BROWSER_TEST_F(SessionsSyncPerfTest, DISABLED_P0) { | 115 IN_PROC_BROWSER_TEST_F(SessionsSyncPerfTest, DISABLED_P0) { |
| 114 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; | 116 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| 115 | 117 |
| 116 AddTabs(0, kNumTabs); | 118 AddTabs(0, kNumTabs); |
| 117 base::TimeDelta dt = | 119 base::TimeDelta dt = TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| 118 SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | |
| 119 ASSERT_EQ(kNumTabs, GetTabCount(0)); | 120 ASSERT_EQ(kNumTabs, GetTabCount(0)); |
| 120 ASSERT_EQ(kNumTabs, GetTabCount(1)); | 121 ASSERT_EQ(kNumTabs, GetTabCount(1)); |
| 121 SyncTimingHelper::PrintResult("tabs", "add_tabs", dt); | 122 PrintResult("tabs", "add_tabs", dt); |
| 122 | 123 |
| 123 UpdateTabs(0); | 124 UpdateTabs(0); |
| 124 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 125 dt = TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| 125 ASSERT_EQ(kNumTabs, GetTabCount(0)); | 126 ASSERT_EQ(kNumTabs, GetTabCount(0)); |
| 126 ASSERT_EQ(kNumTabs, GetTabCount(1)); | 127 ASSERT_EQ(kNumTabs, GetTabCount(1)); |
| 127 SyncTimingHelper::PrintResult("tabs", "update_tabs", dt); | 128 PrintResult("tabs", "update_tabs", dt); |
| 128 | 129 |
| 129 RemoveTabs(0); | 130 RemoveTabs(0); |
| 130 dt = SyncTimingHelper::TimeMutualSyncCycle(GetClient(0), GetClient(1)); | 131 dt = TimeMutualSyncCycle(GetClient(0), GetClient(1)); |
| 131 // New tab page remains open on profile 0 after closing all tabs. | 132 // New tab page remains open on profile 0 after closing all tabs. |
| 132 ASSERT_EQ(1, GetTabCount(0)); | 133 ASSERT_EQ(1, GetTabCount(0)); |
| 133 ASSERT_EQ(0, GetTabCount(1)); | 134 ASSERT_EQ(0, GetTabCount(1)); |
| 134 SyncTimingHelper::PrintResult("tabs", "delete_tabs", dt); | 135 PrintResult("tabs", "delete_tabs", dt); |
| 135 } | 136 } |
| OLD | NEW |