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

Side by Side Diff: components/network_time/network_time_tracker_unittest.cc

Issue 2232663002: Remove NetworkTimeTracker.UpdateTimeFetchAttempted histogram (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mark histogram as obsolete instead of deleting Created 4 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/network_time/network_time_tracker.h" 5 #include "components/network_time/network_time_tracker.h"
6 6
7 #include <map> 7 #include <map>
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 15 matching lines...) Expand all
26 #include "net/http/http_response_headers.h" 26 #include "net/http/http_response_headers.h"
27 #include "net/test/embedded_test_server/embedded_test_server.h" 27 #include "net/test/embedded_test_server/embedded_test_server.h"
28 #include "net/test/embedded_test_server/http_response.h" 28 #include "net/test/embedded_test_server/http_response.h"
29 #include "net/url_request/url_fetcher.h" 29 #include "net/url_request/url_fetcher.h"
30 #include "net/url_request/url_request_test_util.h" 30 #include "net/url_request/url_request_test_util.h"
31 #include "testing/gtest/include/gtest/gtest.h" 31 #include "testing/gtest/include/gtest/gtest.h"
32 32
33 namespace network_time { 33 namespace network_time {
34 34
35 namespace { 35 namespace {
36 const char kFetchAttemptHistogram[] =
37 "NetworkTimeTracker.UpdateTimeFetchAttempted";
38 const char kFetchFailedHistogram[] = "NetworkTimeTracker.UpdateTimeFetchFailed"; 36 const char kFetchFailedHistogram[] = "NetworkTimeTracker.UpdateTimeFetchFailed";
39 const char kFetchValidHistogram[] = "NetworkTimeTracker.UpdateTimeFetchValid"; 37 const char kFetchValidHistogram[] = "NetworkTimeTracker.UpdateTimeFetchValid";
40 } // namespace 38 } // namespace
41 39
42 class NetworkTimeTrackerTest : public testing::Test { 40 class NetworkTimeTrackerTest : public testing::Test {
43 public: 41 public:
44 ~NetworkTimeTrackerTest() override {} 42 ~NetworkTimeTrackerTest() override {}
45 43
46 NetworkTimeTrackerTest() 44 NetworkTimeTrackerTest()
47 : io_thread_("IO thread"), 45 : io_thread_("IO thread"),
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 437
440 base::Time out_network_time; 438 base::Time out_network_time;
441 EXPECT_TRUE(tracker_->GetNetworkTime(&out_network_time, nullptr)); 439 EXPECT_TRUE(tracker_->GetNetworkTime(&out_network_time, nullptr));
442 clock_->Advance(base::TimeDelta::FromDays(1)); 440 clock_->Advance(base::TimeDelta::FromDays(1));
443 Reset(); 441 Reset();
444 EXPECT_FALSE(tracker_->GetNetworkTime(&out_network_time, nullptr)); 442 EXPECT_FALSE(tracker_->GetNetworkTime(&out_network_time, nullptr));
445 } 443 }
446 444
447 TEST_F(NetworkTimeTrackerTest, UpdateFromNetwork) { 445 TEST_F(NetworkTimeTrackerTest, UpdateFromNetwork) {
448 base::HistogramTester histograms; 446 base::HistogramTester histograms;
449 histograms.ExpectTotalCount(kFetchAttemptHistogram, 0);
450 histograms.ExpectTotalCount(kFetchFailedHistogram, 0); 447 histograms.ExpectTotalCount(kFetchFailedHistogram, 0);
451 histograms.ExpectTotalCount(kFetchValidHistogram, 0); 448 histograms.ExpectTotalCount(kFetchValidHistogram, 0);
452 449
453 base::Time out_network_time; 450 base::Time out_network_time;
454 EXPECT_FALSE(tracker_->GetNetworkTime(&out_network_time, nullptr)); 451 EXPECT_FALSE(tracker_->GetNetworkTime(&out_network_time, nullptr));
455 // First query should happen soon. 452 // First query should happen soon.
456 EXPECT_EQ(base::TimeDelta::FromMinutes(0), 453 EXPECT_EQ(base::TimeDelta::FromMinutes(0),
457 tracker_->GetTimerDelayForTesting()); 454 tracker_->GetTimerDelayForTesting());
458 455
459 test_server_->RegisterRequestHandler( 456 test_server_->RegisterRequestHandler(
460 base::Bind(&NetworkTimeTrackerTest::GoodTimeResponseHandler)); 457 base::Bind(&NetworkTimeTrackerTest::GoodTimeResponseHandler));
461 EXPECT_TRUE(test_server_->Start()); 458 EXPECT_TRUE(test_server_->Start());
462 tracker_->SetTimeServerURLForTesting(test_server_->GetURL("/")); 459 tracker_->SetTimeServerURLForTesting(test_server_->GetURL("/"));
463 EXPECT_TRUE(tracker_->QueryTimeServiceForTesting()); 460 EXPECT_TRUE(tracker_->QueryTimeServiceForTesting());
464 tracker_->WaitForFetchForTesting(123123123); 461 tracker_->WaitForFetchForTesting(123123123);
465 462
466 EXPECT_TRUE(tracker_->GetNetworkTime(&out_network_time, nullptr)); 463 EXPECT_TRUE(tracker_->GetNetworkTime(&out_network_time, nullptr));
467 EXPECT_EQ(base::Time::UnixEpoch() + 464 EXPECT_EQ(base::Time::UnixEpoch() +
468 base::TimeDelta::FromMilliseconds(1461621971825), 465 base::TimeDelta::FromMilliseconds(1461621971825),
469 out_network_time); 466 out_network_time);
470 // Should see no backoff in the success case. 467 // Should see no backoff in the success case.
471 EXPECT_EQ(base::TimeDelta::FromMinutes(60), 468 EXPECT_EQ(base::TimeDelta::FromMinutes(60),
472 tracker_->GetTimerDelayForTesting()); 469 tracker_->GetTimerDelayForTesting());
473 470
474 histograms.ExpectTotalCount(kFetchAttemptHistogram, 1);
475 histograms.ExpectTotalCount(kFetchFailedHistogram, 0); 471 histograms.ExpectTotalCount(kFetchFailedHistogram, 0);
476 histograms.ExpectTotalCount(kFetchValidHistogram, 1); 472 histograms.ExpectTotalCount(kFetchValidHistogram, 1);
477 histograms.ExpectBucketCount(kFetchValidHistogram, true, 1); 473 histograms.ExpectBucketCount(kFetchValidHistogram, true, 1);
478 } 474 }
479 475
480 TEST_F(NetworkTimeTrackerTest, NoNetworkQueryWhileSynced) { 476 TEST_F(NetworkTimeTrackerTest, NoNetworkQueryWhileSynced) {
481 test_server_->RegisterRequestHandler( 477 test_server_->RegisterRequestHandler(
482 base::Bind(&NetworkTimeTrackerTest::GoodTimeResponseHandler)); 478 base::Bind(&NetworkTimeTrackerTest::GoodTimeResponseHandler));
483 EXPECT_TRUE(test_server_->Start()); 479 EXPECT_TRUE(test_server_->Start());
484 tracker_->SetTimeServerURLForTesting(test_server_->GetURL("/")); 480 tracker_->SetTimeServerURLForTesting(test_server_->GetURL("/"));
(...skipping 24 matching lines...) Expand all
509 tracker_->GetTimerDelayForTesting()); 505 tracker_->GetTimerDelayForTesting());
510 506
511 // Enable time queries and check that a query is sent. 507 // Enable time queries and check that a query is sent.
512 SetNetworkQueriesWithVariationsService(true, 0.0); 508 SetNetworkQueriesWithVariationsService(true, 0.0);
513 EXPECT_TRUE(tracker_->QueryTimeServiceForTesting()); 509 EXPECT_TRUE(tracker_->QueryTimeServiceForTesting());
514 tracker_->WaitForFetchForTesting(123123123); 510 tracker_->WaitForFetchForTesting(123123123);
515 } 511 }
516 512
517 TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkBadSignature) { 513 TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkBadSignature) {
518 base::HistogramTester histograms; 514 base::HistogramTester histograms;
519 histograms.ExpectTotalCount(kFetchAttemptHistogram, 0);
520 histograms.ExpectTotalCount(kFetchFailedHistogram, 0); 515 histograms.ExpectTotalCount(kFetchFailedHistogram, 0);
521 histograms.ExpectTotalCount(kFetchValidHistogram, 0); 516 histograms.ExpectTotalCount(kFetchValidHistogram, 0);
522 517
523 test_server_->RegisterRequestHandler( 518 test_server_->RegisterRequestHandler(
524 base::Bind(&NetworkTimeTrackerTest::BadSignatureResponseHandler)); 519 base::Bind(&NetworkTimeTrackerTest::BadSignatureResponseHandler));
525 EXPECT_TRUE(test_server_->Start()); 520 EXPECT_TRUE(test_server_->Start());
526 tracker_->SetTimeServerURLForTesting(test_server_->GetURL("/")); 521 tracker_->SetTimeServerURLForTesting(test_server_->GetURL("/"));
527 EXPECT_TRUE(tracker_->QueryTimeServiceForTesting()); 522 EXPECT_TRUE(tracker_->QueryTimeServiceForTesting());
528 tracker_->WaitForFetchForTesting(123123123); 523 tracker_->WaitForFetchForTesting(123123123);
529 524
530 base::Time out_network_time; 525 base::Time out_network_time;
531 EXPECT_FALSE(tracker_->GetNetworkTime(&out_network_time, nullptr)); 526 EXPECT_FALSE(tracker_->GetNetworkTime(&out_network_time, nullptr));
532 EXPECT_EQ(base::TimeDelta::FromMinutes(120), 527 EXPECT_EQ(base::TimeDelta::FromMinutes(120),
533 tracker_->GetTimerDelayForTesting()); 528 tracker_->GetTimerDelayForTesting());
534 529
535 histograms.ExpectTotalCount(kFetchAttemptHistogram, 1);
536 histograms.ExpectTotalCount(kFetchFailedHistogram, 0); 530 histograms.ExpectTotalCount(kFetchFailedHistogram, 0);
537 histograms.ExpectTotalCount(kFetchValidHistogram, 1); 531 histograms.ExpectTotalCount(kFetchValidHistogram, 1);
538 histograms.ExpectBucketCount(kFetchValidHistogram, false, 1); 532 histograms.ExpectBucketCount(kFetchValidHistogram, false, 1);
539 } 533 }
540 534
541 static const uint8_t kDevKeyPubBytes[] = { 535 static const uint8_t kDevKeyPubBytes[] = {
542 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02, 536 0x30, 0x59, 0x30, 0x13, 0x06, 0x07, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x02,
543 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03, 537 0x01, 0x06, 0x08, 0x2a, 0x86, 0x48, 0xce, 0x3d, 0x03, 0x01, 0x07, 0x03,
544 0x42, 0x00, 0x04, 0xe0, 0x6b, 0x0d, 0x76, 0x75, 0xa3, 0x99, 0x7d, 0x7c, 538 0x42, 0x00, 0x04, 0xe0, 0x6b, 0x0d, 0x76, 0x75, 0xa3, 0x99, 0x7d, 0x7c,
545 0x1b, 0xd6, 0x3c, 0x73, 0xbb, 0x4b, 0xfe, 0x0a, 0xe7, 0x2f, 0x61, 0x3d, 539 0x1b, 0xd6, 0x3c, 0x73, 0xbb, 0x4b, 0xfe, 0x0a, 0xe7, 0x2f, 0x61, 0x3d,
546 0x77, 0x0a, 0xaa, 0x14, 0xd8, 0x5a, 0xbf, 0x14, 0x60, 0xec, 0xf6, 0x32, 540 0x77, 0x0a, 0xaa, 0x14, 0xd8, 0x5a, 0xbf, 0x14, 0x60, 0xec, 0xf6, 0x32,
547 0x77, 0xb5, 0xa7, 0xe6, 0x35, 0xa5, 0x61, 0xaf, 0xdc, 0xdf, 0x91, 0xce, 541 0x77, 0xb5, 0xa7, 0xe6, 0x35, 0xa5, 0x61, 0xaf, 0xdc, 0xdf, 0x91, 0xce,
548 0x45, 0x34, 0x5f, 0x36, 0x85, 0x2f, 0xb9, 0x53, 0x00, 0x5d, 0x86, 0xe7, 542 0x45, 0x34, 0x5f, 0x36, 0x85, 0x2f, 0xb9, 0x53, 0x00, 0x5d, 0x86, 0xe7,
549 0x04, 0x16, 0xe2, 0x3d, 0x21, 0x76, 0x2b}; 543 0x04, 0x16, 0xe2, 0x3d, 0x21, 0x76, 0x2b};
550 544
551 TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkBadData) { 545 TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkBadData) {
552 base::HistogramTester histograms; 546 base::HistogramTester histograms;
553 histograms.ExpectTotalCount(kFetchAttemptHistogram, 0);
554 histograms.ExpectTotalCount(kFetchFailedHistogram, 0); 547 histograms.ExpectTotalCount(kFetchFailedHistogram, 0);
555 histograms.ExpectTotalCount(kFetchValidHistogram, 0); 548 histograms.ExpectTotalCount(kFetchValidHistogram, 0);
556 549
557 test_server_->RegisterRequestHandler( 550 test_server_->RegisterRequestHandler(
558 base::Bind(&NetworkTimeTrackerTest::BadDataResponseHandler)); 551 base::Bind(&NetworkTimeTrackerTest::BadDataResponseHandler));
559 EXPECT_TRUE(test_server_->Start()); 552 EXPECT_TRUE(test_server_->Start());
560 base::StringPiece key = {reinterpret_cast<const char*>(kDevKeyPubBytes), 553 base::StringPiece key = {reinterpret_cast<const char*>(kDevKeyPubBytes),
561 sizeof(kDevKeyPubBytes)}; 554 sizeof(kDevKeyPubBytes)};
562 tracker_->SetPublicKeyForTesting(key); 555 tracker_->SetPublicKeyForTesting(key);
563 tracker_->SetTimeServerURLForTesting(test_server_->GetURL("/")); 556 tracker_->SetTimeServerURLForTesting(test_server_->GetURL("/"));
564 EXPECT_TRUE(tracker_->QueryTimeServiceForTesting()); 557 EXPECT_TRUE(tracker_->QueryTimeServiceForTesting());
565 tracker_->WaitForFetchForTesting(123123123); 558 tracker_->WaitForFetchForTesting(123123123);
566 base::Time out_network_time; 559 base::Time out_network_time;
567 EXPECT_FALSE(tracker_->GetNetworkTime(&out_network_time, nullptr)); 560 EXPECT_FALSE(tracker_->GetNetworkTime(&out_network_time, nullptr));
568 EXPECT_EQ(base::TimeDelta::FromMinutes(120), 561 EXPECT_EQ(base::TimeDelta::FromMinutes(120),
569 tracker_->GetTimerDelayForTesting()); 562 tracker_->GetTimerDelayForTesting());
570 563
571 histograms.ExpectTotalCount(kFetchAttemptHistogram, 1);
572 histograms.ExpectTotalCount(kFetchFailedHistogram, 0); 564 histograms.ExpectTotalCount(kFetchFailedHistogram, 0);
573 histograms.ExpectTotalCount(kFetchValidHistogram, 1); 565 histograms.ExpectTotalCount(kFetchValidHistogram, 1);
574 histograms.ExpectBucketCount(kFetchValidHistogram, false, 1); 566 histograms.ExpectBucketCount(kFetchValidHistogram, false, 1);
575 } 567 }
576 568
577 TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkServerError) { 569 TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkServerError) {
578 base::HistogramTester histograms; 570 base::HistogramTester histograms;
579 histograms.ExpectTotalCount(kFetchAttemptHistogram, 0);
580 histograms.ExpectTotalCount(kFetchFailedHistogram, 0); 571 histograms.ExpectTotalCount(kFetchFailedHistogram, 0);
581 histograms.ExpectTotalCount(kFetchValidHistogram, 0); 572 histograms.ExpectTotalCount(kFetchValidHistogram, 0);
582 573
583 test_server_->RegisterRequestHandler( 574 test_server_->RegisterRequestHandler(
584 base::Bind(&NetworkTimeTrackerTest::ServerErrorResponseHandler)); 575 base::Bind(&NetworkTimeTrackerTest::ServerErrorResponseHandler));
585 EXPECT_TRUE(test_server_->Start()); 576 EXPECT_TRUE(test_server_->Start());
586 tracker_->SetTimeServerURLForTesting(test_server_->GetURL("/")); 577 tracker_->SetTimeServerURLForTesting(test_server_->GetURL("/"));
587 EXPECT_TRUE(tracker_->QueryTimeServiceForTesting()); 578 EXPECT_TRUE(tracker_->QueryTimeServiceForTesting());
588 tracker_->WaitForFetchForTesting(123123123); 579 tracker_->WaitForFetchForTesting(123123123);
589 580
590 base::Time out_network_time; 581 base::Time out_network_time;
591 EXPECT_FALSE(tracker_->GetNetworkTime(&out_network_time, nullptr)); 582 EXPECT_FALSE(tracker_->GetNetworkTime(&out_network_time, nullptr));
592 // Should see backoff in the error case. 583 // Should see backoff in the error case.
593 EXPECT_EQ(base::TimeDelta::FromMinutes(120), 584 EXPECT_EQ(base::TimeDelta::FromMinutes(120),
594 tracker_->GetTimerDelayForTesting()); 585 tracker_->GetTimerDelayForTesting());
595 586
596 histograms.ExpectTotalCount(kFetchAttemptHistogram, 1);
597 histograms.ExpectTotalCount(kFetchFailedHistogram, 1); 587 histograms.ExpectTotalCount(kFetchFailedHistogram, 1);
598 // There was no network error, so the histogram is recorded as 588 // There was no network error, so the histogram is recorded as
599 // net::OK, indicating that the connection succeeded but there was a 589 // net::OK, indicating that the connection succeeded but there was a
600 // non-200 HTTP status code. 590 // non-200 HTTP status code.
601 histograms.ExpectBucketCount(kFetchFailedHistogram, net::OK, 1); 591 histograms.ExpectBucketCount(kFetchFailedHistogram, net::OK, 1);
602 histograms.ExpectTotalCount(kFetchValidHistogram, 0); 592 histograms.ExpectTotalCount(kFetchValidHistogram, 0);
603 } 593 }
604 594
605 TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkNetworkError) { 595 TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkNetworkError) {
606 base::HistogramTester histograms; 596 base::HistogramTester histograms;
607 histograms.ExpectTotalCount(kFetchAttemptHistogram, 0);
608 histograms.ExpectTotalCount(kFetchFailedHistogram, 0); 597 histograms.ExpectTotalCount(kFetchFailedHistogram, 0);
609 histograms.ExpectTotalCount(kFetchValidHistogram, 0); 598 histograms.ExpectTotalCount(kFetchValidHistogram, 0);
610 599
611 test_server_->RegisterRequestHandler( 600 test_server_->RegisterRequestHandler(
612 base::Bind(&NetworkTimeTrackerTest::NetworkErrorResponseHandler)); 601 base::Bind(&NetworkTimeTrackerTest::NetworkErrorResponseHandler));
613 EXPECT_TRUE(test_server_->Start()); 602 EXPECT_TRUE(test_server_->Start());
614 tracker_->SetTimeServerURLForTesting(test_server_->GetURL("/")); 603 tracker_->SetTimeServerURLForTesting(test_server_->GetURL("/"));
615 EXPECT_TRUE(tracker_->QueryTimeServiceForTesting()); 604 EXPECT_TRUE(tracker_->QueryTimeServiceForTesting());
616 tracker_->WaitForFetchForTesting(123123123); 605 tracker_->WaitForFetchForTesting(123123123);
617 606
618 base::Time out_network_time; 607 base::Time out_network_time;
619 EXPECT_FALSE(tracker_->GetNetworkTime(&out_network_time, nullptr)); 608 EXPECT_FALSE(tracker_->GetNetworkTime(&out_network_time, nullptr));
620 // Should see backoff in the error case. 609 // Should see backoff in the error case.
621 EXPECT_EQ(base::TimeDelta::FromMinutes(120), 610 EXPECT_EQ(base::TimeDelta::FromMinutes(120),
622 tracker_->GetTimerDelayForTesting()); 611 tracker_->GetTimerDelayForTesting());
623 612
624 histograms.ExpectTotalCount(kFetchAttemptHistogram, 1);
625 histograms.ExpectTotalCount(kFetchFailedHistogram, 1); 613 histograms.ExpectTotalCount(kFetchFailedHistogram, 1);
626 histograms.ExpectBucketCount(kFetchFailedHistogram, -net::ERR_EMPTY_RESPONSE, 614 histograms.ExpectBucketCount(kFetchFailedHistogram, -net::ERR_EMPTY_RESPONSE,
627 1); 615 1);
628 histograms.ExpectTotalCount(kFetchValidHistogram, 0); 616 histograms.ExpectTotalCount(kFetchValidHistogram, 0);
629 } 617 }
630 618
631 TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkLargeResponse) { 619 TEST_F(NetworkTimeTrackerTest, UpdateFromNetworkLargeResponse) {
632 base::HistogramTester histograms; 620 base::HistogramTester histograms;
633 histograms.ExpectTotalCount(kFetchAttemptHistogram, 0);
634 histograms.ExpectTotalCount(kFetchFailedHistogram, 0); 621 histograms.ExpectTotalCount(kFetchFailedHistogram, 0);
635 histograms.ExpectTotalCount(kFetchValidHistogram, 0); 622 histograms.ExpectTotalCount(kFetchValidHistogram, 0);
636 623
637 test_server_->RegisterRequestHandler( 624 test_server_->RegisterRequestHandler(
638 base::Bind(&NetworkTimeTrackerTest::GoodTimeResponseHandler)); 625 base::Bind(&NetworkTimeTrackerTest::GoodTimeResponseHandler));
639 EXPECT_TRUE(test_server_->Start()); 626 EXPECT_TRUE(test_server_->Start());
640 tracker_->SetTimeServerURLForTesting(test_server_->GetURL("/")); 627 tracker_->SetTimeServerURLForTesting(test_server_->GetURL("/"));
641 628
642 base::Time out_network_time; 629 base::Time out_network_time;
643 630
644 tracker_->SetMaxResponseSizeForTesting(3); 631 tracker_->SetMaxResponseSizeForTesting(3);
645 EXPECT_TRUE(tracker_->QueryTimeServiceForTesting()); 632 EXPECT_TRUE(tracker_->QueryTimeServiceForTesting());
646 tracker_->WaitForFetchForTesting(123123123); 633 tracker_->WaitForFetchForTesting(123123123);
647 EXPECT_FALSE(tracker_->GetNetworkTime(&out_network_time, nullptr)); 634 EXPECT_FALSE(tracker_->GetNetworkTime(&out_network_time, nullptr));
648 635
649 histograms.ExpectTotalCount(kFetchAttemptHistogram, 1);
650 histograms.ExpectTotalCount(kFetchFailedHistogram, 1); 636 histograms.ExpectTotalCount(kFetchFailedHistogram, 1);
651 histograms.ExpectTotalCount(kFetchValidHistogram, 0); 637 histograms.ExpectTotalCount(kFetchValidHistogram, 0);
652 638
653 tracker_->SetMaxResponseSizeForTesting(1024); 639 tracker_->SetMaxResponseSizeForTesting(1024);
654 EXPECT_TRUE(tracker_->QueryTimeServiceForTesting()); 640 EXPECT_TRUE(tracker_->QueryTimeServiceForTesting());
655 tracker_->WaitForFetchForTesting(123123123); 641 tracker_->WaitForFetchForTesting(123123123);
656 EXPECT_TRUE(tracker_->GetNetworkTime(&out_network_time, nullptr)); 642 EXPECT_TRUE(tracker_->GetNetworkTime(&out_network_time, nullptr));
657 643
658 histograms.ExpectTotalCount(kFetchAttemptHistogram, 2);
659 histograms.ExpectTotalCount(kFetchFailedHistogram, 1); 644 histograms.ExpectTotalCount(kFetchFailedHistogram, 1);
660 histograms.ExpectTotalCount(kFetchValidHistogram, 1); 645 histograms.ExpectTotalCount(kFetchValidHistogram, 1);
661 histograms.ExpectBucketCount(kFetchValidHistogram, true, 1); 646 histograms.ExpectBucketCount(kFetchValidHistogram, true, 1);
662 } 647 }
663 648
664 } // namespace network_time 649 } // namespace network_time
OLDNEW
« no previous file with comments | « components/network_time/network_time_tracker.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698