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

Side by Side Diff: chrome/browser/metrics/variations/variations_service_unittest.cc

Issue 59953005: Store prefs::kVariationsSeedDate on a variations server 304. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/metrics/variations/variations_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/metrics/variations/variations_service.h" 5 #include "chrome/browser/metrics/variations/variations_service.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/prefs/testing_pref_service.h" 10 #include "base/prefs/testing_pref_service.h"
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 EXPECT_TRUE(prefs.FindPreference(prefs::kVariationsSeed)->IsDefaultValue()); 376 EXPECT_TRUE(prefs.FindPreference(prefs::kVariationsSeed)->IsDefaultValue());
377 377
378 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); 378 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0);
379 SimulateServerResponse(non_ok_status_codes[i], fetcher); 379 SimulateServerResponse(non_ok_status_codes[i], fetcher);
380 variations_service.OnURLFetchComplete(fetcher); 380 variations_service.OnURLFetchComplete(fetcher);
381 381
382 EXPECT_TRUE(prefs.FindPreference(prefs::kVariationsSeed)->IsDefaultValue()); 382 EXPECT_TRUE(prefs.FindPreference(prefs::kVariationsSeed)->IsDefaultValue());
383 } 383 }
384 } 384 }
385 385
386 TEST_F(VariationsServiceTest, SeedDateUpdatedOn304Status) {
387 base::MessageLoop message_loop;
388 content::TestBrowserThread io_thread(content::BrowserThread::IO,
389 &message_loop);
390 TestingPrefServiceSimple prefs;
391 VariationsService::RegisterPrefs(prefs.registry());
392
393 VariationsService variations_service(new TestRequestAllowedNotifier, &prefs);
394 net::TestURLFetcherFactory factory;
395 variations_service.DoActualFetch();
396 EXPECT_TRUE(
397 prefs.FindPreference(prefs::kVariationsSeedDate)->IsDefaultValue());
398
399 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0);
400 SimulateServerResponse(net::HTTP_NOT_MODIFIED, fetcher);
401 variations_service.OnURLFetchComplete(fetcher);
402 EXPECT_FALSE(
403 prefs.FindPreference(prefs::kVariationsSeedDate)->IsDefaultValue());
404 }
405
386 } // namespace chrome_variations 406 } // namespace chrome_variations
OLDNEW
« no previous file with comments | « chrome/browser/metrics/variations/variations_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698