OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/background_sync/background_sync_controller_impl.h" | 5 #include "chrome/browser/background_sync/background_sync_controller_impl.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "chrome/common/features.h" | |
11 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
12 #include "components/rappor/test_rappor_service.h" | 11 #include "components/rappor/test_rappor_service.h" |
13 #include "components/variations/variations_associated_data.h" | 12 #include "components/variations/variations_associated_data.h" |
14 #include "content/public/browser/background_sync_parameters.h" | 13 #include "content/public/browser/background_sync_parameters.h" |
15 #include "content/public/test/test_browser_thread_bundle.h" | 14 #include "content/public/test/test_browser_thread_bundle.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "url/gurl.h" | 16 #include "url/gurl.h" |
18 | 17 |
19 #if BUILDFLAG(ANDROID_JAVA_UI) | 18 #if defined(OS_ANDROID) |
20 #include "chrome/browser/android/background_sync_launcher_android.h" | 19 #include "chrome/browser/android/background_sync_launcher_android.h" |
21 #endif | 20 #endif |
22 | 21 |
23 namespace { | 22 namespace { |
24 | 23 |
25 using content::BackgroundSyncController; | 24 using content::BackgroundSyncController; |
26 | 25 |
27 const char kFieldTrialGroup[] = "GroupA"; | 26 const char kFieldTrialGroup[] = "GroupA"; |
28 | 27 |
29 class TestBackgroundSyncControllerImpl : public BackgroundSyncControllerImpl { | 28 class TestBackgroundSyncControllerImpl : public BackgroundSyncControllerImpl { |
(...skipping 15 matching lines...) Expand all Loading... |
45 DISALLOW_COPY_AND_ASSIGN(TestBackgroundSyncControllerImpl); | 44 DISALLOW_COPY_AND_ASSIGN(TestBackgroundSyncControllerImpl); |
46 }; | 45 }; |
47 | 46 |
48 class BackgroundSyncControllerImplTest : public testing::Test { | 47 class BackgroundSyncControllerImplTest : public testing::Test { |
49 protected: | 48 protected: |
50 BackgroundSyncControllerImplTest() | 49 BackgroundSyncControllerImplTest() |
51 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), | 50 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), |
52 controller_( | 51 controller_( |
53 new TestBackgroundSyncControllerImpl(&profile_, &rappor_service_)) { | 52 new TestBackgroundSyncControllerImpl(&profile_, &rappor_service_)) { |
54 ResetFieldTrialList(); | 53 ResetFieldTrialList(); |
55 #if BUILDFLAG(ANDROID_JAVA_UI) | 54 #if defined(OS_ANDROID) |
56 BackgroundSyncLauncherAndroid::SetPlayServicesVersionCheckDisabledForTests( | 55 BackgroundSyncLauncherAndroid::SetPlayServicesVersionCheckDisabledForTests( |
57 true); | 56 true); |
58 #endif | 57 #endif |
59 } | 58 } |
60 | 59 |
61 void ResetFieldTrialList() { | 60 void ResetFieldTrialList() { |
62 field_trial_list_.reset( | 61 field_trial_list_.reset( |
63 new base::FieldTrialList(nullptr /* entropy provider */)); | 62 new base::FieldTrialList(nullptr /* entropy provider */)); |
64 variations::testing::ClearAllVariationParams(); | 63 variations::testing::ClearAllVariationParams(); |
65 base::FieldTrialList::CreateFieldTrial( | 64 base::FieldTrialList::CreateFieldTrial( |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 sync_parameters.initial_retry_delay); | 156 sync_parameters.initial_retry_delay); |
158 EXPECT_EQ(200, sync_parameters.max_sync_attempts); | 157 EXPECT_EQ(200, sync_parameters.max_sync_attempts); |
159 EXPECT_EQ(300, sync_parameters.retry_delay_factor); | 158 EXPECT_EQ(300, sync_parameters.retry_delay_factor); |
160 EXPECT_EQ(base::TimeDelta::FromSeconds(400), | 159 EXPECT_EQ(base::TimeDelta::FromSeconds(400), |
161 sync_parameters.min_sync_recovery_time); | 160 sync_parameters.min_sync_recovery_time); |
162 EXPECT_EQ(base::TimeDelta::FromSeconds(500), | 161 EXPECT_EQ(base::TimeDelta::FromSeconds(500), |
163 sync_parameters.max_sync_event_duration); | 162 sync_parameters.max_sync_event_duration); |
164 } | 163 } |
165 | 164 |
166 } // namespace | 165 } // namespace |
OLD | NEW |