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

Side by Side Diff: chrome/browser/policy/cloud/cloud_policy_invalidator_unittest.cc

Issue 23754021: Invalidation trickles mega-patch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <string> 5 #include <string>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 void StorePolicy(PolicyObject object) { 100 void StorePolicy(PolicyObject object) {
101 StorePolicy(object, 0); 101 StorePolicy(object, 0);
102 } 102 }
103 103
104 // Disables the invalidation service. It is enabled by default. 104 // Disables the invalidation service. It is enabled by default.
105 void DisableInvalidationService(); 105 void DisableInvalidationService();
106 106
107 // Enables the invalidation service. It is enabled by default. 107 // Enables the invalidation service. It is enabled by default.
108 void EnableInvalidationService(); 108 void EnableInvalidationService();
109 109
110 // Causes the invalidation service to fire an invalidation. Returns an ack 110 // Causes the invalidation service to fire an invalidation.
111 // handle which be used to verify that the invalidation was acknowledged. 111 syncer::Invalidation FireInvalidation(
112 syncer::AckHandle FireInvalidation(
113 PolicyObject object, 112 PolicyObject object,
114 int64 version, 113 int64 version,
115 const std::string& payload); 114 const std::string& payload);
116 115
117 // Causes the invalidation service to fire an invalidation with unknown 116 // Causes the invalidation service to fire an invalidation with unknown
118 // version. Returns an ack handle which be used to verify that the 117 // version.
119 // invalidation was acknowledged. 118 syncer::Invalidation FireUnknownVersionInvalidation(PolicyObject object);
120 syncer::AckHandle FireInvalidation(PolicyObject object);
121 119
122 // Checks the expected value of the currently set invalidation info. 120 // Checks the expected value of the currently set invalidation info.
123 bool CheckInvalidationInfo(int64 version, const std::string& payload); 121 bool CheckInvalidationInfo(int64 version, const std::string& payload);
124 122
125 // Checks that the policy was not refreshed due to an invalidation. 123 // Checks that the policy was not refreshed due to an invalidation.
126 bool CheckPolicyNotRefreshed(); 124 bool CheckPolicyNotRefreshed();
127 125
128 // Checks that the policy was refreshed due to an invalidation within an 126 // Checks that the policy was refreshed due to an invalidation within an
129 // appropriate timeframe depending on whether the invalidation had unknown 127 // appropriate timeframe depending on whether the invalidation had unknown
130 // version. 128 // version.
131 bool CheckPolicyRefreshed(); 129 bool CheckPolicyRefreshed();
132 bool CheckPolicyRefreshedWithUnknownVersion(); 130 bool CheckPolicyRefreshedWithUnknownVersion();
133 131
132 bool IsUnsent(const syncer::Invalidation& invalidation);
133
134 // Checks that the state changed callback of the invalidation handler was not
135 // called.
136 bool CheckStateChangedNotCalled();
137
134 // Returns the invalidations enabled state set by the invalidator on the 138 // Returns the invalidations enabled state set by the invalidator on the
135 // refresh scheduler. 139 // refresh scheduler.
136 bool InvalidationsEnabled(); 140 bool InvalidationsEnabled();
137 141
138 // Determines if the invalidation with the given ack handle has been 142 // Determines if the invalidation with the given ack handle has been
139 // acknowledged. 143 // acknowledged.
140 bool IsInvalidationAcknowledged(const syncer::AckHandle& ack_handle); 144 bool IsInvalidationAcknowledged(const syncer::Invalidation& invalidation);
141 145
142 // Determines if the invalidator has registered for an object with the 146 // Determines if the invalidator has registered for an object with the
143 // invalidation service. 147 // invalidation service.
144 bool IsInvalidatorRegistered(); 148 bool IsInvalidatorRegistered();
145 149
146 // Get the current count for the given metric. 150 // Get the current count for the given metric.
147 base::HistogramBase::Count GetCount(MetricPolicyRefresh metric); 151 base::HistogramBase::Count GetCount(MetricPolicyRefresh metric);
148 base::HistogramBase::Count GetInvalidationCount(bool with_payload); 152 base::HistogramBase::Count GetInvalidationCount(bool with_payload);
149 153
150 private: 154 private:
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 policy_value_b_("zxcv"), 214 policy_value_b_("zxcv"),
211 policy_value_cur_(policy_value_a_) {} 215 policy_value_cur_(policy_value_a_) {}
212 216
213 void CloudPolicyInvalidatorTest::SetUp() { 217 void CloudPolicyInvalidatorTest::SetUp() {
214 base::StatisticsRecorder::Initialize(); 218 base::StatisticsRecorder::Initialize();
215 refresh_samples_ = GetHistogramSamples(kMetricPolicyRefresh); 219 refresh_samples_ = GetHistogramSamples(kMetricPolicyRefresh);
216 invalidations_samples_ = GetHistogramSamples(kMetricPolicyInvalidations); 220 invalidations_samples_ = GetHistogramSamples(kMetricPolicyInvalidations);
217 } 221 }
218 222
219 void CloudPolicyInvalidatorTest::TearDown() { 223 void CloudPolicyInvalidatorTest::TearDown() {
220 EXPECT_FALSE(invalidation_service_.ReceivedInvalidAcknowledgement());
221 if (invalidator_) 224 if (invalidator_)
222 invalidator_->Shutdown(); 225 invalidator_->Shutdown();
223 core_.Disconnect(); 226 core_.Disconnect();
224 } 227 }
225 228
226 void CloudPolicyInvalidatorTest::StartInvalidator( 229 void CloudPolicyInvalidatorTest::StartInvalidator(
227 bool initialize, 230 bool initialize,
228 bool start_refresh_scheduler) { 231 bool start_refresh_scheduler) {
229 invalidator_.reset(new CloudPolicyInvalidator(&core_, task_runner_)); 232 invalidator_.reset(new CloudPolicyInvalidator(&core_, task_runner_));
230 if (start_refresh_scheduler) { 233 if (start_refresh_scheduler) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 297
295 void CloudPolicyInvalidatorTest::DisableInvalidationService() { 298 void CloudPolicyInvalidatorTest::DisableInvalidationService() {
296 invalidation_service_.SetInvalidatorState( 299 invalidation_service_.SetInvalidatorState(
297 syncer::TRANSIENT_INVALIDATION_ERROR); 300 syncer::TRANSIENT_INVALIDATION_ERROR);
298 } 301 }
299 302
300 void CloudPolicyInvalidatorTest::EnableInvalidationService() { 303 void CloudPolicyInvalidatorTest::EnableInvalidationService() {
301 invalidation_service_.SetInvalidatorState(syncer::INVALIDATIONS_ENABLED); 304 invalidation_service_.SetInvalidatorState(syncer::INVALIDATIONS_ENABLED);
302 } 305 }
303 306
304 syncer::AckHandle CloudPolicyInvalidatorTest::FireInvalidation( 307 syncer::Invalidation CloudPolicyInvalidatorTest::FireInvalidation(
305 PolicyObject object, 308 PolicyObject object,
306 int64 version, 309 int64 version,
307 const std::string& payload) { 310 const std::string& payload) {
308 return invalidation_service_.EmitInvalidationForTest( 311 syncer::Invalidation invalidation = syncer::Invalidation::Init(
309 GetPolicyObjectId(object), 312 GetPolicyObjectId(object),
310 version, 313 version,
311 payload); 314 payload);
315 invalidation_service_.EmitInvalidationForTest(invalidation);
316 return invalidation;
312 } 317 }
313 318
314 syncer::AckHandle CloudPolicyInvalidatorTest::FireInvalidation( 319 syncer::Invalidation CloudPolicyInvalidatorTest::FireUnknownVersionInvalidation(
315 PolicyObject object) { 320 PolicyObject object) {
316 return invalidation_service_.EmitInvalidationForTest( 321 syncer::Invalidation invalidation = syncer::Invalidation::InitUnknownVersion(
317 GetPolicyObjectId(object), 322 GetPolicyObjectId(object));
318 syncer::Invalidation::kUnknownVersion, 323 invalidation_service_.EmitInvalidationForTest(invalidation);
319 std::string()); 324 return invalidation;
320 } 325 }
321 326
322 bool CloudPolicyInvalidatorTest::CheckInvalidationInfo( 327 bool CloudPolicyInvalidatorTest::CheckInvalidationInfo(
323 int64 version, 328 int64 version,
324 const std::string& payload) { 329 const std::string& payload) {
325 MockCloudPolicyClient* client = 330 MockCloudPolicyClient* client =
326 static_cast<MockCloudPolicyClient*>(core_.client()); 331 static_cast<MockCloudPolicyClient*>(core_.client());
327 return version == client->invalidation_version_ && 332 return version == client->invalidation_version_ &&
328 payload == client->invalidation_payload_; 333 payload == client->invalidation_payload_;
329 } 334 }
330 335
331 bool CloudPolicyInvalidatorTest::CheckPolicyNotRefreshed() { 336 bool CloudPolicyInvalidatorTest::CheckPolicyNotRefreshed() {
332 return CheckPolicyRefreshCount(0); 337 return CheckPolicyRefreshCount(0);
333 } 338 }
334 339
335 bool CloudPolicyInvalidatorTest::CheckPolicyRefreshed() { 340 bool CloudPolicyInvalidatorTest::CheckPolicyRefreshed() {
336 return CheckPolicyRefreshed(base::TimeDelta()); 341 return CheckPolicyRefreshed(base::TimeDelta());
337 } 342 }
338 343
344 bool CloudPolicyInvalidatorTest::IsUnsent(
345 const syncer::Invalidation& invalidation) {
346 return invalidation_service_.GetMockAckHandler()->IsUnsent(invalidation);
347 }
348
339 bool CloudPolicyInvalidatorTest::CheckPolicyRefreshedWithUnknownVersion() { 349 bool CloudPolicyInvalidatorTest::CheckPolicyRefreshedWithUnknownVersion() {
340 return CheckPolicyRefreshed(base::TimeDelta::FromMinutes( 350 return CheckPolicyRefreshed(base::TimeDelta::FromMinutes(
341 CloudPolicyInvalidator::kMissingPayloadDelay)); 351 CloudPolicyInvalidator::kMissingPayloadDelay));
342 } 352 }
343 353
344 bool CloudPolicyInvalidatorTest::InvalidationsEnabled() { 354 bool CloudPolicyInvalidatorTest::InvalidationsEnabled() {
345 return core_.refresh_scheduler()->invalidations_available(); 355 return core_.refresh_scheduler()->invalidations_available();
346 } 356 }
347 357
348 bool CloudPolicyInvalidatorTest::IsInvalidationAcknowledged( 358 bool CloudPolicyInvalidatorTest::IsInvalidationAcknowledged(
349 const syncer::AckHandle& ack_handle) { 359 const syncer::Invalidation& invalidation) {
350 return invalidation_service_.IsInvalidationAcknowledged(ack_handle); 360 // The acknowledgement task is run through a WeakHandle. We need to run any
361 // posted tasks before we can check acknowledgement status.
362 loop_.RunUntilIdle();
363
364 EXPECT_FALSE(IsUnsent(invalidation));
365 return !invalidation_service_.GetMockAckHandler()->IsUnacked(invalidation);
351 } 366 }
352 367
353 bool CloudPolicyInvalidatorTest::IsInvalidatorRegistered() { 368 bool CloudPolicyInvalidatorTest::IsInvalidatorRegistered() {
354 return !invalidation_service_.invalidator_registrar() 369 return !invalidation_service_.invalidator_registrar()
355 .GetRegisteredIds(invalidator_.get()).empty(); 370 .GetRegisteredIds(invalidator_.get()).empty();
356 } 371 }
357 372
358 base::HistogramBase::Count CloudPolicyInvalidatorTest::GetCount( 373 base::HistogramBase::Count CloudPolicyInvalidatorTest::GetCount(
359 MetricPolicyRefresh metric) { 374 MetricPolicyRefresh metric) {
360 return GetHistogramSamples(kMetricPolicyRefresh)->GetCount(metric) - 375 return GetHistogramSamples(kMetricPolicyRefresh)->GetCount(metric) -
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 if (!histogram) 428 if (!histogram)
414 return scoped_ptr<base::HistogramSamples>(new base::SampleMap()); 429 return scoped_ptr<base::HistogramSamples>(new base::SampleMap());
415 return histogram->SnapshotSamples(); 430 return histogram->SnapshotSamples();
416 } 431 }
417 432
418 TEST_F(CloudPolicyInvalidatorTest, Uninitialized) { 433 TEST_F(CloudPolicyInvalidatorTest, Uninitialized) {
419 // No invalidations should be processed if the invalidator is not initialized. 434 // No invalidations should be processed if the invalidator is not initialized.
420 StartInvalidator(false /* initialize */, true /* start_refresh_scheduler */); 435 StartInvalidator(false /* initialize */, true /* start_refresh_scheduler */);
421 StorePolicy(POLICY_OBJECT_A); 436 StorePolicy(POLICY_OBJECT_A);
422 EXPECT_FALSE(IsInvalidatorRegistered()); 437 EXPECT_FALSE(IsInvalidatorRegistered());
423 FireInvalidation(POLICY_OBJECT_A); 438 EXPECT_TRUE(IsUnsent(FireUnknownVersionInvalidation(POLICY_OBJECT_A)));
424 EXPECT_TRUE(CheckPolicyNotRefreshed()); 439 EXPECT_TRUE(CheckPolicyNotRefreshed());
425 } 440 }
426 441
427 TEST_F(CloudPolicyInvalidatorTest, RefreshSchedulerNotStarted) { 442 TEST_F(CloudPolicyInvalidatorTest, RefreshSchedulerNotStarted) {
428 // No invalidations should be processed if the refresh scheduler is not 443 // No invalidations should be processed if the refresh scheduler is not
429 // started. 444 // started.
430 StartInvalidator(true /* initialize */, false /* start_refresh_scheduler */); 445 StartInvalidator(true /* initialize */, false /* start_refresh_scheduler */);
431 StorePolicy(POLICY_OBJECT_A); 446 StorePolicy(POLICY_OBJECT_A);
432 EXPECT_FALSE(IsInvalidatorRegistered()); 447 EXPECT_FALSE(IsInvalidatorRegistered());
433 FireInvalidation(POLICY_OBJECT_A); 448 EXPECT_TRUE(IsUnsent(FireUnknownVersionInvalidation(POLICY_OBJECT_A)));
434 EXPECT_TRUE(CheckPolicyNotRefreshed()); 449 EXPECT_TRUE(CheckPolicyNotRefreshed());
435 } 450 }
436 451
437 TEST_F(CloudPolicyInvalidatorTest, DisconnectCoreThenInitialize) { 452 TEST_F(CloudPolicyInvalidatorTest, DisconnectCoreThenInitialize) {
438 // No invalidations should be processed if the core is disconnected before 453 // No invalidations should be processed if the core is disconnected before
439 // initialization. 454 // initialization.
440 StartInvalidator(false /* initialize */, true /* start_refresh_scheduler */); 455 StartInvalidator(false /* initialize */, true /* start_refresh_scheduler */);
441 DisconnectCore(); 456 DisconnectCore();
442 InitializeInvalidator(); 457 InitializeInvalidator();
443 StorePolicy(POLICY_OBJECT_A); 458 StorePolicy(POLICY_OBJECT_A);
444 EXPECT_FALSE(IsInvalidatorRegistered()); 459 EXPECT_FALSE(IsInvalidatorRegistered());
445 FireInvalidation(POLICY_OBJECT_A); 460 EXPECT_TRUE(IsUnsent(FireUnknownVersionInvalidation(POLICY_OBJECT_A)));
446 EXPECT_TRUE(CheckPolicyNotRefreshed()); 461 EXPECT_TRUE(CheckPolicyNotRefreshed());
447 } 462 }
448 463
449 TEST_F(CloudPolicyInvalidatorTest, InitializeThenStartRefreshScheduler) { 464 TEST_F(CloudPolicyInvalidatorTest, InitializeThenStartRefreshScheduler) {
450 // Make sure registration occurs and invalidations are processed when 465 // Make sure registration occurs and invalidations are processed when
451 // Initialize is called before starting the refresh scheduler. 466 // Initialize is called before starting the refresh scheduler.
452 // Note that the reverse case (start refresh scheduler then initialize) is 467 // Note that the reverse case (start refresh scheduler then initialize) is
453 // the default behavior for the test fixture, so will be tested in most other 468 // the default behavior for the test fixture, so will be tested in most other
454 // tests. 469 // tests.
455 StartInvalidator(true /* initialize */, false /* start_refresh_scheduler */); 470 StartInvalidator(true /* initialize */, false /* start_refresh_scheduler */);
456 ConnectCore(); 471 ConnectCore();
457 StartRefreshScheduler(); 472 StartRefreshScheduler();
458 StorePolicy(POLICY_OBJECT_A); 473 StorePolicy(POLICY_OBJECT_A);
459 EXPECT_TRUE(IsInvalidatorRegistered()); 474 EXPECT_TRUE(IsInvalidatorRegistered());
460 FireInvalidation(POLICY_OBJECT_A); 475 FireUnknownVersionInvalidation(POLICY_OBJECT_A);
461 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion()); 476 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion());
462 } 477 }
463 478
464 TEST_F(CloudPolicyInvalidatorTest, RegisterOnStoreLoaded) { 479 TEST_F(CloudPolicyInvalidatorTest, RegisterOnStoreLoaded) {
465 // No registration when store is not loaded. 480 // No registration when store is not loaded.
466 StartInvalidator(); 481 StartInvalidator();
467 EXPECT_FALSE(IsInvalidatorRegistered()); 482 EXPECT_FALSE(IsInvalidatorRegistered());
468 EXPECT_FALSE(InvalidationsEnabled()); 483 EXPECT_FALSE(InvalidationsEnabled());
469 FireInvalidation(POLICY_OBJECT_A); 484 EXPECT_TRUE(IsUnsent(FireUnknownVersionInvalidation(POLICY_OBJECT_A)));
470 FireInvalidation(POLICY_OBJECT_B); 485 EXPECT_TRUE(IsUnsent(FireUnknownVersionInvalidation(POLICY_OBJECT_B)));
471 EXPECT_TRUE(CheckPolicyNotRefreshed()); 486 EXPECT_TRUE(CheckPolicyNotRefreshed());
472 487
473 // No registration when store is loaded with no invalidation object id. 488 // No registration when store is loaded with no invalidation object id.
474 StorePolicy(POLICY_OBJECT_NONE); 489 StorePolicy(POLICY_OBJECT_NONE);
475 EXPECT_FALSE(IsInvalidatorRegistered()); 490 EXPECT_FALSE(IsInvalidatorRegistered());
476 EXPECT_FALSE(InvalidationsEnabled()); 491 EXPECT_FALSE(InvalidationsEnabled());
477 FireInvalidation(POLICY_OBJECT_A); 492 EXPECT_TRUE(IsUnsent(FireUnknownVersionInvalidation(POLICY_OBJECT_A)));
478 FireInvalidation(POLICY_OBJECT_B); 493 EXPECT_TRUE(IsUnsent(FireUnknownVersionInvalidation(POLICY_OBJECT_B)));
479 EXPECT_TRUE(CheckPolicyNotRefreshed()); 494 EXPECT_TRUE(CheckPolicyNotRefreshed());
480 495
481 // Check registration when store is loaded for object A. 496 // Check registration when store is loaded for object A.
482 StorePolicy(POLICY_OBJECT_A); 497 StorePolicy(POLICY_OBJECT_A);
483 EXPECT_TRUE(IsInvalidatorRegistered()); 498 EXPECT_TRUE(IsInvalidatorRegistered());
484 EXPECT_TRUE(InvalidationsEnabled()); 499 EXPECT_TRUE(InvalidationsEnabled());
485 FireInvalidation(POLICY_OBJECT_A); 500 FireUnknownVersionInvalidation(POLICY_OBJECT_A);
486 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion()); 501 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion());
487 FireInvalidation(POLICY_OBJECT_B); 502 EXPECT_TRUE(IsUnsent(FireUnknownVersionInvalidation(POLICY_OBJECT_B)));
488 EXPECT_TRUE(CheckPolicyNotRefreshed()); 503 EXPECT_TRUE(CheckPolicyNotRefreshed());
489 } 504 }
490 505
491 TEST_F(CloudPolicyInvalidatorTest, ChangeRegistration) { 506 TEST_F(CloudPolicyInvalidatorTest, ChangeRegistration) {
492 // Register for object A. 507 // Register for object A.
493 StartInvalidator(); 508 StartInvalidator();
494 StorePolicy(POLICY_OBJECT_A); 509 StorePolicy(POLICY_OBJECT_A);
495 EXPECT_TRUE(IsInvalidatorRegistered()); 510 EXPECT_TRUE(IsInvalidatorRegistered());
496 EXPECT_TRUE(InvalidationsEnabled()); 511 EXPECT_TRUE(InvalidationsEnabled());
497 FireInvalidation(POLICY_OBJECT_A); 512 FireUnknownVersionInvalidation(POLICY_OBJECT_A);
498 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion()); 513 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion());
499 FireInvalidation(POLICY_OBJECT_B); 514 EXPECT_TRUE(IsUnsent(FireUnknownVersionInvalidation(POLICY_OBJECT_B)));
500 EXPECT_TRUE(CheckPolicyNotRefreshed()); 515 EXPECT_TRUE(CheckPolicyNotRefreshed());
501 syncer::AckHandle ack = FireInvalidation(POLICY_OBJECT_A); 516 syncer::Invalidation inv = FireUnknownVersionInvalidation(POLICY_OBJECT_A);
502 517
503 // Check re-registration for object B. Make sure the pending invalidation for 518 // Check re-registration for object B. Make sure the pending invalidation for
504 // object A is acknowledged without making the callback. 519 // object A is acknowledged without making the callback.
505 StorePolicy(POLICY_OBJECT_B); 520 StorePolicy(POLICY_OBJECT_B);
506 EXPECT_TRUE(IsInvalidatorRegistered()); 521 EXPECT_TRUE(IsInvalidatorRegistered());
507 EXPECT_TRUE(InvalidationsEnabled()); 522 EXPECT_TRUE(InvalidationsEnabled());
508 EXPECT_TRUE(IsInvalidationAcknowledged(ack)); 523 EXPECT_TRUE(IsInvalidationAcknowledged(inv));
509 EXPECT_TRUE(CheckPolicyNotRefreshed()); 524 EXPECT_TRUE(CheckPolicyNotRefreshed());
510 525
511 // Make sure future invalidations for object A are ignored and for object B 526 // Make sure future invalidations for object A are ignored and for object B
512 // are processed. 527 // are processed.
513 FireInvalidation(POLICY_OBJECT_A); 528 EXPECT_TRUE(IsUnsent(FireUnknownVersionInvalidation(POLICY_OBJECT_A)));
514 EXPECT_TRUE(CheckPolicyNotRefreshed()); 529 EXPECT_TRUE(CheckPolicyNotRefreshed());
515 FireInvalidation(POLICY_OBJECT_B); 530 FireUnknownVersionInvalidation(POLICY_OBJECT_B);
516 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion()); 531 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion());
517 } 532 }
518 533
519 TEST_F(CloudPolicyInvalidatorTest, UnregisterOnStoreLoaded) { 534 TEST_F(CloudPolicyInvalidatorTest, UnregisterOnStoreLoaded) {
520 // Register for object A. 535 // Register for object A.
521 StartInvalidator(); 536 StartInvalidator();
522 StorePolicy(POLICY_OBJECT_A); 537 StorePolicy(POLICY_OBJECT_A);
523 EXPECT_TRUE(IsInvalidatorRegistered()); 538 EXPECT_TRUE(IsInvalidatorRegistered());
524 EXPECT_TRUE(InvalidationsEnabled()); 539 EXPECT_TRUE(InvalidationsEnabled());
525 FireInvalidation(POLICY_OBJECT_A); 540 FireUnknownVersionInvalidation(POLICY_OBJECT_A);
526 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion()); 541 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion());
527 542
528 // Check unregistration when store is loaded with no invalidation object id. 543 // Check unregistration when store is loaded with no invalidation object id.
529 syncer::AckHandle ack = FireInvalidation(POLICY_OBJECT_A); 544 syncer::Invalidation inv = FireUnknownVersionInvalidation(POLICY_OBJECT_A);
530 EXPECT_FALSE(IsInvalidationAcknowledged(ack)); 545 EXPECT_FALSE(IsInvalidationAcknowledged(inv));
531 StorePolicy(POLICY_OBJECT_NONE); 546 StorePolicy(POLICY_OBJECT_NONE);
532 EXPECT_FALSE(IsInvalidatorRegistered()); 547 EXPECT_FALSE(IsInvalidatorRegistered());
533 EXPECT_TRUE(IsInvalidationAcknowledged(ack)); 548 EXPECT_TRUE(IsInvalidationAcknowledged(inv));
534 EXPECT_FALSE(InvalidationsEnabled()); 549 EXPECT_FALSE(InvalidationsEnabled());
535 FireInvalidation(POLICY_OBJECT_A); 550 EXPECT_TRUE(IsUnsent(FireUnknownVersionInvalidation(POLICY_OBJECT_A)));
536 FireInvalidation(POLICY_OBJECT_B); 551 EXPECT_TRUE(IsUnsent(FireUnknownVersionInvalidation(POLICY_OBJECT_B)));
537 EXPECT_TRUE(CheckPolicyNotRefreshed()); 552 EXPECT_TRUE(CheckPolicyNotRefreshed());
538 553
539 // Check re-registration for object B. 554 // Check re-registration for object B.
540 StorePolicy(POLICY_OBJECT_B); 555 StorePolicy(POLICY_OBJECT_B);
541 EXPECT_TRUE(IsInvalidatorRegistered()); 556 EXPECT_TRUE(IsInvalidatorRegistered());
542 EXPECT_TRUE(InvalidationsEnabled()); 557 EXPECT_TRUE(InvalidationsEnabled());
543 FireInvalidation(POLICY_OBJECT_B); 558 FireUnknownVersionInvalidation(POLICY_OBJECT_B);
544 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion()); 559 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion());
545 } 560 }
546 561
547 TEST_F(CloudPolicyInvalidatorTest, HandleInvalidation) { 562 TEST_F(CloudPolicyInvalidatorTest, HandleInvalidation) {
548 // Register and fire invalidation 563 // Register and fire invalidation
549 StorePolicy(POLICY_OBJECT_A); 564 StorePolicy(POLICY_OBJECT_A);
550 StartInvalidator(); 565 StartInvalidator();
551 EXPECT_TRUE(InvalidationsEnabled()); 566 EXPECT_TRUE(InvalidationsEnabled());
552 syncer::AckHandle ack = FireInvalidation(POLICY_OBJECT_A, 12, "test_payload"); 567 syncer::Invalidation inv =
568 FireInvalidation(POLICY_OBJECT_A, 12, "test_payload");
553 569
554 // Make sure client info is set as soon as the invalidation is received. 570 // Make sure client info is set as soon as the invalidation is received.
555 EXPECT_TRUE(CheckInvalidationInfo(12, "test_payload")); 571 EXPECT_TRUE(CheckInvalidationInfo(12, "test_payload"));
556 EXPECT_TRUE(CheckPolicyRefreshed()); 572 EXPECT_TRUE(CheckPolicyRefreshed());
557 573
558 // Make sure invalidation is not acknowledged until the store is loaded. 574 // Make sure invalidation is not acknowledged until the store is loaded.
559 EXPECT_FALSE(IsInvalidationAcknowledged(ack)); 575 EXPECT_FALSE(IsInvalidationAcknowledged(inv));
560 EXPECT_TRUE(CheckInvalidationInfo(12, "test_payload")); 576 EXPECT_TRUE(CheckInvalidationInfo(12, "test_payload"));
561 StorePolicy(POLICY_OBJECT_A, 12); 577 StorePolicy(POLICY_OBJECT_A, 12);
562 EXPECT_TRUE(IsInvalidationAcknowledged(ack)); 578 EXPECT_TRUE(IsInvalidationAcknowledged(inv));
563 EXPECT_TRUE(CheckInvalidationInfo(0, std::string())); 579 EXPECT_TRUE(CheckInvalidationInfo(0, std::string()));
564 } 580 }
565 581
566 TEST_F(CloudPolicyInvalidatorTest, HandleInvalidationWithUnknownVersion) { 582 TEST_F(CloudPolicyInvalidatorTest, HandleInvalidationWithUnknownVersion) {
567 // Register and fire invalidation with unknown version. 583 // Register and fire invalidation with unknown version.
568 StorePolicy(POLICY_OBJECT_A); 584 StorePolicy(POLICY_OBJECT_A);
569 StartInvalidator(); 585 StartInvalidator();
570 syncer::AckHandle ack = FireInvalidation(POLICY_OBJECT_A); 586 syncer::Invalidation inv = FireUnknownVersionInvalidation(POLICY_OBJECT_A);
571 587
572 // Make sure client info is not set until after the invalidation callback is 588 // Make sure client info is not set until after the invalidation callback is
573 // made. 589 // made.
574 EXPECT_TRUE(CheckInvalidationInfo(0, std::string())); 590 EXPECT_TRUE(CheckInvalidationInfo(0, std::string()));
575 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion()); 591 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion());
576 EXPECT_TRUE(CheckInvalidationInfo(-1, std::string())); 592 EXPECT_TRUE(CheckInvalidationInfo(-1, std::string()));
577 593
578 // Make sure invalidation is not acknowledged until the store is loaded. 594 // Make sure invalidation is not acknowledged until the store is loaded.
579 EXPECT_FALSE(IsInvalidationAcknowledged(ack)); 595 EXPECT_FALSE(IsInvalidationAcknowledged(inv));
580 StorePolicy(POLICY_OBJECT_A, -1); 596 StorePolicy(POLICY_OBJECT_A, -1);
581 EXPECT_TRUE(IsInvalidationAcknowledged(ack)); 597 EXPECT_TRUE(IsInvalidationAcknowledged(inv));
582 EXPECT_TRUE(CheckInvalidationInfo(0, std::string())); 598 EXPECT_TRUE(CheckInvalidationInfo(0, std::string()));
583 } 599 }
584 600
585 TEST_F(CloudPolicyInvalidatorTest, HandleMultipleInvalidations) { 601 TEST_F(CloudPolicyInvalidatorTest, HandleMultipleInvalidations) {
586 // Generate multiple invalidations. 602 // Generate multiple invalidations.
587 StorePolicy(POLICY_OBJECT_A); 603 StorePolicy(POLICY_OBJECT_A);
588 StartInvalidator(); 604 StartInvalidator();
589 syncer::AckHandle ack1 = FireInvalidation(POLICY_OBJECT_A, 1, "test1"); 605 syncer::Invalidation inv1 = FireInvalidation(POLICY_OBJECT_A, 1, "test1");
590 EXPECT_TRUE(CheckInvalidationInfo(1, "test1")); 606 EXPECT_TRUE(CheckInvalidationInfo(1, "test1"));
591 syncer::AckHandle ack2 = FireInvalidation(POLICY_OBJECT_A, 2, "test2"); 607 syncer::Invalidation inv2 = FireInvalidation(POLICY_OBJECT_A, 2, "test2");
592 EXPECT_TRUE(CheckInvalidationInfo(2, "test2")); 608 EXPECT_TRUE(CheckInvalidationInfo(2, "test2"));
593 syncer::AckHandle ack3= FireInvalidation(POLICY_OBJECT_A, 3, "test3"); 609 syncer::Invalidation inv3 = FireInvalidation(POLICY_OBJECT_A, 3, "test3");
594 EXPECT_TRUE(CheckInvalidationInfo(3, "test3")); 610 EXPECT_TRUE(CheckInvalidationInfo(3, "test3"));
595 611
596 // Make sure the replaced invalidations are acknowledged. 612 // Make sure the replaced invalidations are acknowledged.
597 EXPECT_TRUE(IsInvalidationAcknowledged(ack1)); 613 EXPECT_TRUE(IsInvalidationAcknowledged(inv1));
598 EXPECT_TRUE(IsInvalidationAcknowledged(ack2)); 614 EXPECT_TRUE(IsInvalidationAcknowledged(inv2));
599 615
600 // Make sure the policy is refreshed once. 616 // Make sure the policy is refreshed once.
601 EXPECT_TRUE(CheckPolicyRefreshed()); 617 EXPECT_TRUE(CheckPolicyRefreshed());
602 618
603 // Make sure that the last invalidation is only acknowledged after the store 619 // Make sure that the last invalidation is only acknowledged after the store
604 // is loaded with the latest version. 620 // is loaded with the latest version.
605 StorePolicy(POLICY_OBJECT_A, 1); 621 StorePolicy(POLICY_OBJECT_A, 1);
606 EXPECT_FALSE(IsInvalidationAcknowledged(ack3)); 622 EXPECT_FALSE(IsInvalidationAcknowledged(inv3));
607 StorePolicy(POLICY_OBJECT_A, 2); 623 StorePolicy(POLICY_OBJECT_A, 2);
608 EXPECT_FALSE(IsInvalidationAcknowledged(ack3)); 624 EXPECT_FALSE(IsInvalidationAcknowledged(inv3));
609 StorePolicy(POLICY_OBJECT_A, 3); 625 StorePolicy(POLICY_OBJECT_A, 3);
610 EXPECT_TRUE(IsInvalidationAcknowledged(ack3)); 626 EXPECT_TRUE(IsInvalidationAcknowledged(inv3));
611 } 627 }
612 628
613 TEST_F(CloudPolicyInvalidatorTest, 629 TEST_F(CloudPolicyInvalidatorTest,
614 HandleMultipleInvalidationsWithUnknownVersion) { 630 HandleMultipleInvalidationsWithUnknownVersion) {
615 // Validate that multiple invalidations with unknown version each generate 631 // Validate that multiple invalidations with unknown version each generate
616 // unique invalidation version numbers. 632 // unique invalidation version numbers.
617 StorePolicy(POLICY_OBJECT_A); 633 StorePolicy(POLICY_OBJECT_A);
618 StartInvalidator(); 634 StartInvalidator();
619 syncer::AckHandle ack1 = FireInvalidation(POLICY_OBJECT_A); 635 syncer::Invalidation inv1 = FireUnknownVersionInvalidation(POLICY_OBJECT_A);
620 EXPECT_TRUE(CheckInvalidationInfo(0, std::string())); 636 EXPECT_TRUE(CheckInvalidationInfo(0, std::string()));
621 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion()); 637 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion());
622 EXPECT_TRUE(CheckInvalidationInfo(-1, std::string())); 638 EXPECT_TRUE(CheckInvalidationInfo(-1, std::string()));
623 syncer::AckHandle ack2 = FireInvalidation(POLICY_OBJECT_A); 639 syncer::Invalidation inv2 = FireUnknownVersionInvalidation(POLICY_OBJECT_A);
624 EXPECT_TRUE(CheckInvalidationInfo(0, std::string())); 640 EXPECT_TRUE(CheckInvalidationInfo(0, std::string()));
625 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion()); 641 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion());
626 EXPECT_TRUE(CheckInvalidationInfo(-2, std::string())); 642 EXPECT_TRUE(CheckInvalidationInfo(-2, std::string()));
627 syncer::AckHandle ack3 = FireInvalidation(POLICY_OBJECT_A); 643 syncer::Invalidation inv3 = FireUnknownVersionInvalidation(POLICY_OBJECT_A);
628 EXPECT_TRUE(CheckInvalidationInfo(0, std::string())); 644 EXPECT_TRUE(CheckInvalidationInfo(0, std::string()));
629 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion()); 645 EXPECT_TRUE(CheckPolicyRefreshedWithUnknownVersion());
630 EXPECT_TRUE(CheckInvalidationInfo(-3, std::string())); 646 EXPECT_TRUE(CheckInvalidationInfo(-3, std::string()));
631 647
632 // Make sure the replaced invalidations are acknowledged. 648 // Make sure the replaced invalidations are acknowledged.
633 EXPECT_TRUE(IsInvalidationAcknowledged(ack1)); 649 EXPECT_TRUE(IsInvalidationAcknowledged(inv1));
634 EXPECT_TRUE(IsInvalidationAcknowledged(ack2)); 650 EXPECT_TRUE(IsInvalidationAcknowledged(inv2));
635 651
636 // Make sure that the last invalidation is only acknowledged after the store 652 // Make sure that the last invalidation is only acknowledged after the store
637 // is loaded with the last unknown version. 653 // is loaded with the last unknown version.
638 StorePolicy(POLICY_OBJECT_A, -1); 654 StorePolicy(POLICY_OBJECT_A, -1);
639 EXPECT_FALSE(IsInvalidationAcknowledged(ack3)); 655 EXPECT_FALSE(IsInvalidationAcknowledged(inv3));
640 StorePolicy(POLICY_OBJECT_A, -2); 656 StorePolicy(POLICY_OBJECT_A, -2);
641 EXPECT_FALSE(IsInvalidationAcknowledged(ack3)); 657 EXPECT_FALSE(IsInvalidationAcknowledged(inv3));
642 StorePolicy(POLICY_OBJECT_A, -3); 658 StorePolicy(POLICY_OBJECT_A, -3);
643 EXPECT_TRUE(IsInvalidationAcknowledged(ack3)); 659 EXPECT_TRUE(IsInvalidationAcknowledged(inv3));
644 } 660 }
645 661
646 TEST_F(CloudPolicyInvalidatorTest, AcknowledgeBeforeRefresh) { 662 TEST_F(CloudPolicyInvalidatorTest, AcknowledgeBeforeRefresh) {
647 // Generate an invalidation. 663 // Generate an invalidation.
648 StorePolicy(POLICY_OBJECT_A); 664 StorePolicy(POLICY_OBJECT_A);
649 StartInvalidator(); 665 StartInvalidator();
650 syncer::AckHandle ack = FireInvalidation(POLICY_OBJECT_A, 3, "test"); 666 syncer::Invalidation inv = FireInvalidation(POLICY_OBJECT_A, 3, "test");
651 667
652 // Ensure that the policy is not refreshed and the invalidation is 668 // Ensure that the policy is not refreshed and the invalidation is
653 // acknowledged if the store is loaded with the latest version before the 669 // acknowledged if the store is loaded with the latest version before the
654 // refresh can occur. 670 // refresh can occur.
655 StorePolicy(POLICY_OBJECT_A, 3); 671 StorePolicy(POLICY_OBJECT_A, 3);
656 EXPECT_TRUE(IsInvalidationAcknowledged(ack)); 672 EXPECT_TRUE(IsInvalidationAcknowledged(inv));
657 EXPECT_TRUE(CheckPolicyNotRefreshed()); 673 EXPECT_TRUE(CheckPolicyNotRefreshed());
658 } 674 }
659 675
660 TEST_F(CloudPolicyInvalidatorTest, NoCallbackAfterShutdown) { 676 TEST_F(CloudPolicyInvalidatorTest, NoCallbackAfterShutdown) {
661 // Generate an invalidation. 677 // Generate an invalidation.
662 StorePolicy(POLICY_OBJECT_A); 678 StorePolicy(POLICY_OBJECT_A);
663 StartInvalidator(); 679 StartInvalidator();
664 syncer::AckHandle ack = FireInvalidation(POLICY_OBJECT_A, 3, "test"); 680 syncer::Invalidation inv = FireInvalidation(POLICY_OBJECT_A, 3, "test");
665 681
666 // Ensure that the policy refresh is not made after the invalidator is shut 682 // Ensure that the policy refresh is not made after the invalidator is shut
667 // down. 683 // down.
668 ShutdownInvalidator(); 684 ShutdownInvalidator();
669 EXPECT_TRUE(CheckPolicyNotRefreshed()); 685 EXPECT_TRUE(CheckPolicyNotRefreshed());
670 DestroyInvalidator(); 686 DestroyInvalidator();
671 } 687 }
672 688
673 TEST_F(CloudPolicyInvalidatorTest, StateChanged) { 689 TEST_F(CloudPolicyInvalidatorTest, StateChanged) {
674 // Test invalidation service state changes while not registered. 690 // Test invalidation service state changes while not registered.
(...skipping 29 matching lines...) Expand all
704 EXPECT_FALSE(InvalidationsEnabled()); 720 EXPECT_FALSE(InvalidationsEnabled());
705 StorePolicy(POLICY_OBJECT_NONE); 721 StorePolicy(POLICY_OBJECT_NONE);
706 StorePolicy(POLICY_OBJECT_A); 722 StorePolicy(POLICY_OBJECT_A);
707 EXPECT_FALSE(InvalidationsEnabled()); 723 EXPECT_FALSE(InvalidationsEnabled());
708 } 724 }
709 725
710 TEST_F(CloudPolicyInvalidatorTest, Disconnect) { 726 TEST_F(CloudPolicyInvalidatorTest, Disconnect) {
711 // Generate an invalidation. 727 // Generate an invalidation.
712 StorePolicy(POLICY_OBJECT_A); 728 StorePolicy(POLICY_OBJECT_A);
713 StartInvalidator(); 729 StartInvalidator();
714 syncer::AckHandle ack = FireInvalidation(POLICY_OBJECT_A, 1, "test"); 730 syncer::Invalidation inv = FireInvalidation(POLICY_OBJECT_A, 1, "test");
715 EXPECT_TRUE(InvalidationsEnabled()); 731 EXPECT_TRUE(InvalidationsEnabled());
716 732
717 // Ensure that the policy is not refreshed after disconnecting the core, but 733 // Ensure that the policy is not refreshed after disconnecting the core, but
718 // a call to indicate that invalidations are disabled is made. 734 // a call to indicate that invalidations are disabled is made.
719 DisconnectCore(); 735 DisconnectCore();
720 EXPECT_TRUE(CheckPolicyNotRefreshed()); 736 EXPECT_TRUE(CheckPolicyNotRefreshed());
721 737
722 // Ensure that invalidation service events do not cause refreshes while the 738 // Ensure that invalidation service events do not cause refreshes while the
723 // invalidator is stopped. 739 // invalidator is stopped.
724 FireInvalidation(POLICY_OBJECT_A, 2, "test"); 740 EXPECT_TRUE(IsUnsent(FireInvalidation(POLICY_OBJECT_A, 2, "test")));
725 EXPECT_TRUE(CheckPolicyNotRefreshed()); 741 EXPECT_TRUE(CheckPolicyNotRefreshed());
726 DisableInvalidationService(); 742 DisableInvalidationService();
727 EnableInvalidationService(); 743 EnableInvalidationService();
728 744
729 // Connect and disconnect without starting the refresh scheduler. 745 // Connect and disconnect without starting the refresh scheduler.
730 ConnectCore(); 746 ConnectCore();
731 FireInvalidation(POLICY_OBJECT_A, 3, "test"); 747 EXPECT_TRUE(IsUnsent(FireInvalidation(POLICY_OBJECT_A, 3, "test")));
732 EXPECT_TRUE(CheckPolicyNotRefreshed()); 748 EXPECT_TRUE(CheckPolicyNotRefreshed());
733 DisconnectCore(); 749 DisconnectCore();
734 FireInvalidation(POLICY_OBJECT_A, 4, "test"); 750 EXPECT_TRUE(IsUnsent(FireInvalidation(POLICY_OBJECT_A, 4, "test")));
735 EXPECT_TRUE(CheckPolicyNotRefreshed()); 751 EXPECT_TRUE(CheckPolicyNotRefreshed());
736 752
737 // Ensure that the invalidator returns to normal after reconnecting. 753 // Ensure that the invalidator returns to normal after reconnecting.
738 ConnectCore(); 754 ConnectCore();
739 StartRefreshScheduler(); 755 StartRefreshScheduler();
740 EXPECT_TRUE(CheckPolicyNotRefreshed()); 756 EXPECT_TRUE(CheckPolicyNotRefreshed());
741 EXPECT_TRUE(InvalidationsEnabled()); 757 EXPECT_TRUE(InvalidationsEnabled());
742 FireInvalidation(POLICY_OBJECT_A, 5, "test"); 758 FireInvalidation(POLICY_OBJECT_A, 5, "test");
743 EXPECT_TRUE(CheckInvalidationInfo(5, "test")); 759 EXPECT_TRUE(CheckInvalidationInfo(5, "test"));
744 EXPECT_TRUE(CheckPolicyRefreshed()); 760 EXPECT_TRUE(CheckPolicyRefreshed());
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
823 EXPECT_EQ(0, GetCount(METRIC_POLICY_REFRESH_CHANGED_NO_INVALIDATIONS)); 839 EXPECT_EQ(0, GetCount(METRIC_POLICY_REFRESH_CHANGED_NO_INVALIDATIONS));
824 EXPECT_EQ(4, GetCount(METRIC_POLICY_REFRESH_UNCHANGED)); 840 EXPECT_EQ(4, GetCount(METRIC_POLICY_REFRESH_UNCHANGED));
825 EXPECT_EQ(2, GetCount(METRIC_POLICY_REFRESH_INVALIDATED_CHANGED)); 841 EXPECT_EQ(2, GetCount(METRIC_POLICY_REFRESH_INVALIDATED_CHANGED));
826 EXPECT_EQ(1, GetCount(METRIC_POLICY_REFRESH_INVALIDATED_UNCHANGED)); 842 EXPECT_EQ(1, GetCount(METRIC_POLICY_REFRESH_INVALIDATED_UNCHANGED));
827 } 843 }
828 844
829 TEST_F(CloudPolicyInvalidatorTest, InvalidationMetrics) { 845 TEST_F(CloudPolicyInvalidatorTest, InvalidationMetrics) {
830 // Generate a mix of versioned and unknown-version invalidations. 846 // Generate a mix of versioned and unknown-version invalidations.
831 StorePolicy(POLICY_OBJECT_A); 847 StorePolicy(POLICY_OBJECT_A);
832 StartInvalidator(); 848 StartInvalidator();
833 FireInvalidation(POLICY_OBJECT_B); 849 EXPECT_TRUE(IsUnsent(FireUnknownVersionInvalidation(POLICY_OBJECT_B)));
834 FireInvalidation(POLICY_OBJECT_A); 850 FireUnknownVersionInvalidation(POLICY_OBJECT_A);
835 FireInvalidation(POLICY_OBJECT_B, 1, "test"); 851 EXPECT_TRUE(IsUnsent(FireInvalidation(POLICY_OBJECT_B, 1, "test")));
836 FireInvalidation(POLICY_OBJECT_A, 1, "test"); 852 FireInvalidation(POLICY_OBJECT_A, 1, "test");
837 FireInvalidation(POLICY_OBJECT_A, 2, "test"); 853 FireInvalidation(POLICY_OBJECT_A, 2, "test");
838 FireInvalidation(POLICY_OBJECT_A); 854 FireUnknownVersionInvalidation(POLICY_OBJECT_A);
839 FireInvalidation(POLICY_OBJECT_A); 855 FireUnknownVersionInvalidation(POLICY_OBJECT_A);
840 FireInvalidation(POLICY_OBJECT_A, 3, "test"); 856 FireInvalidation(POLICY_OBJECT_A, 3, "test");
841 FireInvalidation(POLICY_OBJECT_A, 4, "test"); 857 FireInvalidation(POLICY_OBJECT_A, 4, "test");
842 858
843 // Verify that received invalidations metrics are correct. 859 // Verify that received invalidations metrics are correct.
844 EXPECT_EQ(3, GetInvalidationCount(false /* with_payload */)); 860 EXPECT_EQ(3, GetInvalidationCount(false /* with_payload */));
845 EXPECT_EQ(4, GetInvalidationCount(true /* with_payload */)); 861 EXPECT_EQ(4, GetInvalidationCount(true /* with_payload */));
846 } 862 }
847 863
848 } // namespace policy 864 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/cloud_policy_invalidator.cc ('k') | chrome/browser/sync/glue/sync_backend_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698