| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "components/variations/service/variations_service.h" | 5 #include "components/variations/service/variations_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 TestingPrefServiceSimple prefs; | 473 TestingPrefServiceSimple prefs; |
| 474 VariationsService::RegisterPrefs(prefs.registry()); | 474 VariationsService::RegisterPrefs(prefs.registry()); |
| 475 | 475 |
| 476 TestVariationsService service( | 476 TestVariationsService service( |
| 477 base::MakeUnique<web_resource::TestRequestAllowedNotifier>(&prefs), | 477 base::MakeUnique<web_resource::TestRequestAllowedNotifier>(&prefs), |
| 478 &prefs); | 478 &prefs); |
| 479 service.set_intercepts_fetch(false); | 479 service.set_intercepts_fetch(false); |
| 480 for (size_t i = 0; i < arraysize(non_ok_status_codes); ++i) { | 480 for (size_t i = 0; i < arraysize(non_ok_status_codes); ++i) { |
| 481 net::TestURLFetcherFactory factory; | 481 net::TestURLFetcherFactory factory; |
| 482 service.DoActualFetch(); | 482 service.DoActualFetch(); |
| 483 EXPECT_TRUE(prefs.FindPreference(prefs::kVariationsSeed)->IsDefaultValue()); | 483 EXPECT_TRUE(prefs.FindPreference(prefs::kVariationsCompressedSeed) |
| 484 ->IsDefaultValue()); |
| 484 | 485 |
| 485 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); | 486 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); |
| 486 SimulateServerResponse(non_ok_status_codes[i], fetcher); | 487 SimulateServerResponse(non_ok_status_codes[i], fetcher); |
| 487 service.OnURLFetchComplete(fetcher); | 488 service.OnURLFetchComplete(fetcher); |
| 488 | 489 |
| 489 EXPECT_TRUE(prefs.FindPreference(prefs::kVariationsSeed)->IsDefaultValue()); | 490 EXPECT_TRUE(prefs.FindPreference(prefs::kVariationsCompressedSeed) |
| 491 ->IsDefaultValue()); |
| 490 } | 492 } |
| 491 } | 493 } |
| 492 | 494 |
| 493 TEST_F(VariationsServiceTest, RequestGzipCompressedSeed) { | 495 TEST_F(VariationsServiceTest, RequestGzipCompressedSeed) { |
| 494 TestingPrefServiceSimple prefs; | 496 TestingPrefServiceSimple prefs; |
| 495 VariationsService::RegisterPrefs(prefs.registry()); | 497 VariationsService::RegisterPrefs(prefs.registry()); |
| 496 net::TestURLFetcherFactory factory; | 498 net::TestURLFetcherFactory factory; |
| 497 | 499 |
| 498 TestVariationsService service( | 500 TestVariationsService service( |
| 499 base::MakeUnique<web_resource::TestRequestAllowedNotifier>(&prefs), | 501 base::MakeUnique<web_resource::TestRequestAllowedNotifier>(&prefs), |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 778 } | 780 } |
| 779 const base::ListValue* pref_value = | 781 const base::ListValue* pref_value = |
| 780 prefs.GetList(prefs::kVariationsPermanentConsistencyCountry); | 782 prefs.GetList(prefs::kVariationsPermanentConsistencyCountry); |
| 781 EXPECT_EQ(ListValueToString(expected_list_value), | 783 EXPECT_EQ(ListValueToString(expected_list_value), |
| 782 ListValueToString(*pref_value)) | 784 ListValueToString(*pref_value)) |
| 783 << test.pref_value_before << ", " << test.country_code_override; | 785 << test.pref_value_before << ", " << test.country_code_override; |
| 784 } | 786 } |
| 785 } | 787 } |
| 786 | 788 |
| 787 } // namespace variations | 789 } // namespace variations |
| OLD | NEW |