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

Side by Side Diff: components/gcm_driver/gcm_driver_desktop_unittest.cc

Issue 772383003: Fix parameter types of CompareDelaySeconds from bool to int64. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « no previous file | 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 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/gcm_driver/gcm_driver_desktop.h" 5 #include "components/gcm_driver/gcm_driver_desktop.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 // Tests a single instance of GCMDriver. 1001 // Tests a single instance of GCMDriver.
1002 class GCMChannelStatusSyncerTest : public GCMDriverTest { 1002 class GCMChannelStatusSyncerTest : public GCMDriverTest {
1003 public: 1003 public:
1004 GCMChannelStatusSyncerTest(); 1004 GCMChannelStatusSyncerTest();
1005 ~GCMChannelStatusSyncerTest() override; 1005 ~GCMChannelStatusSyncerTest() override;
1006 1006
1007 // testing::Test: 1007 // testing::Test:
1008 void SetUp() override; 1008 void SetUp() override;
1009 1009
1010 void CompleteGCMChannelStatusRequest(bool enabled, int poll_interval_seconds); 1010 void CompleteGCMChannelStatusRequest(bool enabled, int poll_interval_seconds);
1011 bool CompareDelaySeconds(bool expected_delay_seconds, 1011 bool CompareDelaySeconds(int64 expected_delay_seconds,
1012 bool actual_delay_seconds); 1012 int64 actual_delay_seconds);
1013 1013
1014 GCMChannelStatusSyncer* syncer() { 1014 GCMChannelStatusSyncer* syncer() {
1015 return driver()->gcm_channel_status_syncer_for_testing(); 1015 return driver()->gcm_channel_status_syncer_for_testing();
1016 } 1016 }
1017 1017
1018 private: 1018 private:
1019 net::TestURLFetcherFactory url_fetcher_factory_; 1019 net::TestURLFetcherFactory url_fetcher_factory_;
1020 1020
1021 DISALLOW_COPY_AND_ASSIGN(GCMChannelStatusSyncerTest); 1021 DISALLOW_COPY_AND_ASSIGN(GCMChannelStatusSyncerTest);
1022 }; 1022 };
(...skipping 27 matching lines...) Expand all
1050 response_proto.SerializeToString(&response_string); 1050 response_proto.SerializeToString(&response_string);
1051 1051
1052 net::TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0); 1052 net::TestURLFetcher* fetcher = url_fetcher_factory_.GetFetcherByID(0);
1053 ASSERT_TRUE(fetcher); 1053 ASSERT_TRUE(fetcher);
1054 fetcher->set_response_code(net::HTTP_OK); 1054 fetcher->set_response_code(net::HTTP_OK);
1055 fetcher->SetResponseString(response_string); 1055 fetcher->SetResponseString(response_string);
1056 fetcher->delegate()->OnURLFetchComplete(fetcher); 1056 fetcher->delegate()->OnURLFetchComplete(fetcher);
1057 } 1057 }
1058 1058
1059 bool GCMChannelStatusSyncerTest::CompareDelaySeconds( 1059 bool GCMChannelStatusSyncerTest::CompareDelaySeconds(
1060 bool expected_delay_seconds, bool actual_delay_seconds) { 1060 int64 expected_delay_seconds, int64 actual_delay_seconds) {
1061 // Most of time, the actual delay should not be smaller than the expected 1061 // Most of time, the actual delay should not be smaller than the expected
1062 // delay. 1062 // delay.
1063 if (actual_delay_seconds >= expected_delay_seconds) 1063 if (actual_delay_seconds >= expected_delay_seconds)
1064 return true; 1064 return true;
1065 // It is also OK that the actual delay is a bit smaller than the expected 1065 // It is also OK that the actual delay is a bit smaller than the expected
1066 // delay in case that the test runs slowly. 1066 // delay in case that the test runs slowly.
1067 return expected_delay_seconds - actual_delay_seconds < 30; 1067 return expected_delay_seconds - actual_delay_seconds < 30;
1068 } 1068 }
1069 1069
1070 TEST_F(GCMChannelStatusSyncerTest, DisableAndEnable) { 1070 TEST_F(GCMChannelStatusSyncerTest, DisableAndEnable) {
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 // After start-up, the request should still be scheduled at the expected 1251 // After start-up, the request should still be scheduled at the expected
1252 // updated interval. 1252 // updated interval.
1253 actual_delay_seconds = 1253 actual_delay_seconds =
1254 syncer()->current_request_delay_interval().InSeconds(); 1254 syncer()->current_request_delay_interval().InSeconds();
1255 EXPECT_TRUE(CompareDelaySeconds(expected_delay_seconds, actual_delay_seconds)) 1255 EXPECT_TRUE(CompareDelaySeconds(expected_delay_seconds, actual_delay_seconds))
1256 << "expected delay: " << expected_delay_seconds 1256 << "expected delay: " << expected_delay_seconds
1257 << " actual delay: " << actual_delay_seconds; 1257 << " actual delay: " << actual_delay_seconds;
1258 } 1258 }
1259 1259
1260 } // namespace gcm 1260 } // namespace gcm
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698