Commit 1eee5dd3 authored by warx's avatar warx Committed by Commit bot

cleanup: Replace NULL with nullptr in network_portal_detector_impl_unittest.cc

Changes:
(1) s/NULL/nullptr/g (2) git cl format; just a cleanup, do not want it included in issue 2756643002

BUG=NONE
TEST=NONE

Review-Url: https://codereview.chromium.org/2753223002
Cr-Commit-Position: refs/heads/master@{#457798}
parent 69cbe27e
...@@ -146,7 +146,7 @@ class NetworkPortalDetectorImplTest ...@@ -146,7 +146,7 @@ class NetworkPortalDetectorImplTest
ASSERT_EQ(expected_no_response_result_count, no_response_result_count()); ASSERT_EQ(expected_no_response_result_count, no_response_result_count());
ASSERT_EQ(base::TimeDelta::FromSeconds(expected_request_timeout_sec), ASSERT_EQ(base::TimeDelta::FromSeconds(expected_request_timeout_sec),
get_next_attempt_timeout()); get_next_attempt_timeout());
CompleteURLFetch(net_error, status_code, NULL); CompleteURLFetch(net_error, status_code, nullptr);
} }
Profile* profile() { return profile_; } Profile* profile() { return profile_; }
...@@ -314,7 +314,7 @@ TEST_F(NetworkPortalDetectorImplTest, NoPortal) { ...@@ -314,7 +314,7 @@ TEST_F(NetworkPortalDetectorImplTest, NoPortal) {
CheckPortalState( CheckPortalState(
NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN, -1, kStubWireless1); NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_UNKNOWN, -1, kStubWireless1);
CompleteURLFetch(net::OK, 204, NULL); CompleteURLFetch(net::OK, 204, nullptr);
ASSERT_FALSE(is_state_idle()); ASSERT_FALSE(is_state_idle());
CheckPortalState( CheckPortalState(
...@@ -332,7 +332,7 @@ TEST_F(NetworkPortalDetectorImplTest, Portal) { ...@@ -332,7 +332,7 @@ TEST_F(NetworkPortalDetectorImplTest, Portal) {
SetConnected(kStubWireless1); SetConnected(kStubWireless1);
ASSERT_TRUE(is_state_checking_for_portal()); ASSERT_TRUE(is_state_checking_for_portal());
CompleteURLFetch(net::OK, 200, NULL); CompleteURLFetch(net::OK, 200, nullptr);
ASSERT_FALSE(is_state_idle()); ASSERT_FALSE(is_state_idle());
CheckPortalState( CheckPortalState(
...@@ -342,7 +342,7 @@ TEST_F(NetworkPortalDetectorImplTest, Portal) { ...@@ -342,7 +342,7 @@ TEST_F(NetworkPortalDetectorImplTest, Portal) {
SetConnected(kStubWireless2); SetConnected(kStubWireless2);
ASSERT_TRUE(is_state_checking_for_portal()); ASSERT_TRUE(is_state_checking_for_portal());
CompleteURLFetch(net::OK, 301, NULL); CompleteURLFetch(net::OK, 301, nullptr);
ASSERT_FALSE(is_state_idle()); ASSERT_FALSE(is_state_idle());
CheckPortalState( CheckPortalState(
...@@ -352,7 +352,7 @@ TEST_F(NetworkPortalDetectorImplTest, Portal) { ...@@ -352,7 +352,7 @@ TEST_F(NetworkPortalDetectorImplTest, Portal) {
SetConnected(kStubEthernet); SetConnected(kStubEthernet);
ASSERT_TRUE(is_state_checking_for_portal()); ASSERT_TRUE(is_state_checking_for_portal());
CompleteURLFetch(net::OK, 302, NULL); CompleteURLFetch(net::OK, 302, nullptr);
ASSERT_FALSE(is_state_idle()); ASSERT_FALSE(is_state_idle());
CheckPortalState( CheckPortalState(
...@@ -376,7 +376,7 @@ TEST_F(NetworkPortalDetectorImplTest, Online2Offline) { ...@@ -376,7 +376,7 @@ TEST_F(NetworkPortalDetectorImplTest, Online2Offline) {
// WiFi is in online state. // WiFi is in online state.
{ {
// When transitioning to a connected state, the network will transition to // When transitioning to a connected state, the network will transition to
// connecting states which will set the default network to NULL. This may // connecting states which will set the default network to nullptr. This may
// get triggered multiple times. // get triggered multiple times.
EXPECT_CALL(observer, OnPortalDetectionCompleted(_, offline_state)) EXPECT_CALL(observer, OnPortalDetectionCompleted(_, offline_state))
.Times(AnyNumber()); .Times(AnyNumber());
...@@ -390,7 +390,7 @@ TEST_F(NetworkPortalDetectorImplTest, Online2Offline) { ...@@ -390,7 +390,7 @@ TEST_F(NetworkPortalDetectorImplTest, Online2Offline) {
SetConnected(kStubWireless1); SetConnected(kStubWireless1);
ASSERT_TRUE(is_state_checking_for_portal()); ASSERT_TRUE(is_state_checking_for_portal());
CompleteURLFetch(net::OK, 204, NULL); CompleteURLFetch(net::OK, 204, nullptr);
ASSERT_FALSE(is_state_idle()); ASSERT_FALSE(is_state_idle());
// Check that observer was notified about online state. // Check that observer was notified about online state.
...@@ -399,7 +399,7 @@ TEST_F(NetworkPortalDetectorImplTest, Online2Offline) { ...@@ -399,7 +399,7 @@ TEST_F(NetworkPortalDetectorImplTest, Online2Offline) {
// WiFi is turned off. // WiFi is turned off.
{ {
EXPECT_CALL(observer, OnPortalDetectionCompleted(NULL, offline_state)) EXPECT_CALL(observer, OnPortalDetectionCompleted(nullptr, offline_state))
.Times(1); .Times(1);
SetDisconnected(kStubWireless1); SetDisconnected(kStubWireless1);
...@@ -424,14 +424,14 @@ TEST_F(NetworkPortalDetectorImplTest, TwoNetworks) { ...@@ -424,14 +424,14 @@ TEST_F(NetworkPortalDetectorImplTest, TwoNetworks) {
ASSERT_TRUE(is_state_checking_for_portal()); ASSERT_TRUE(is_state_checking_for_portal());
// WiFi is in portal state. // WiFi is in portal state.
CompleteURLFetch(net::OK, 200, NULL); CompleteURLFetch(net::OK, 200, nullptr);
ASSERT_FALSE(is_state_idle()); ASSERT_FALSE(is_state_idle());
SetConnected(kStubEthernet); SetConnected(kStubEthernet);
ASSERT_TRUE(is_state_checking_for_portal()); ASSERT_TRUE(is_state_checking_for_portal());
// ethernet is in online state. // ethernet is in online state.
CompleteURLFetch(net::OK, 204, NULL); CompleteURLFetch(net::OK, 204, nullptr);
ASSERT_FALSE(is_state_idle()); ASSERT_FALSE(is_state_idle());
CheckPortalState( CheckPortalState(
NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE, 204, kStubEthernet); NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE, 204, kStubEthernet);
...@@ -462,7 +462,7 @@ TEST_F(NetworkPortalDetectorImplTest, NetworkChanged) { ...@@ -462,7 +462,7 @@ TEST_F(NetworkPortalDetectorImplTest, NetworkChanged) {
ASSERT_TRUE(is_state_checking_for_portal()); ASSERT_TRUE(is_state_checking_for_portal());
// ethernet is in online state. // ethernet is in online state.
CompleteURLFetch(net::OK, 204, NULL); CompleteURLFetch(net::OK, 204, nullptr);
ASSERT_FALSE(is_state_idle()); ASSERT_FALSE(is_state_idle());
CheckPortalState( CheckPortalState(
NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE, 204, kStubEthernet); NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE, 204, kStubEthernet);
...@@ -484,7 +484,7 @@ TEST_F(NetworkPortalDetectorImplTest, NetworkStateNotChanged) { ...@@ -484,7 +484,7 @@ TEST_F(NetworkPortalDetectorImplTest, NetworkStateNotChanged) {
SetConnected(kStubWireless1); SetConnected(kStubWireless1);
ASSERT_TRUE(is_state_checking_for_portal()); ASSERT_TRUE(is_state_checking_for_portal());
CompleteURLFetch(net::OK, 204, NULL); CompleteURLFetch(net::OK, 204, nullptr);
ASSERT_FALSE(is_state_idle()); ASSERT_FALSE(is_state_idle());
CheckPortalState( CheckPortalState(
...@@ -506,7 +506,7 @@ TEST_F(NetworkPortalDetectorImplTest, NetworkStateChanged) { ...@@ -506,7 +506,7 @@ TEST_F(NetworkPortalDetectorImplTest, NetworkStateChanged) {
SetBehindPortal(kStubWireless1); SetBehindPortal(kStubWireless1);
ASSERT_TRUE(is_state_checking_for_portal()); ASSERT_TRUE(is_state_checking_for_portal());
CompleteURLFetch(net::OK, 200, NULL); CompleteURLFetch(net::OK, 200, nullptr);
ASSERT_FALSE(is_state_idle()); ASSERT_FALSE(is_state_idle());
CheckPortalState( CheckPortalState(
...@@ -515,7 +515,7 @@ TEST_F(NetworkPortalDetectorImplTest, NetworkStateChanged) { ...@@ -515,7 +515,7 @@ TEST_F(NetworkPortalDetectorImplTest, NetworkStateChanged) {
SetConnected(kStubWireless1); SetConnected(kStubWireless1);
ASSERT_TRUE(is_state_checking_for_portal()); ASSERT_TRUE(is_state_checking_for_portal());
CompleteURLFetch(net::OK, 204, NULL); CompleteURLFetch(net::OK, 204, nullptr);
ASSERT_FALSE(is_state_idle()); ASSERT_FALSE(is_state_idle());
CheckPortalState( CheckPortalState(
...@@ -524,7 +524,7 @@ TEST_F(NetworkPortalDetectorImplTest, NetworkStateChanged) { ...@@ -524,7 +524,7 @@ TEST_F(NetworkPortalDetectorImplTest, NetworkStateChanged) {
SetBehindPortal(kStubWireless1); SetBehindPortal(kStubWireless1);
ASSERT_TRUE(is_state_checking_for_portal()); ASSERT_TRUE(is_state_checking_for_portal());
CompleteURLFetch(net::OK, 200, NULL); CompleteURLFetch(net::OK, 200, nullptr);
ASSERT_FALSE(is_state_idle()); ASSERT_FALSE(is_state_idle());
CheckPortalState( CheckPortalState(
...@@ -618,7 +618,7 @@ TEST_F(NetworkPortalDetectorImplTest, FirstAttemptFailed) { ...@@ -618,7 +618,7 @@ TEST_F(NetworkPortalDetectorImplTest, FirstAttemptFailed) {
// To run CaptivePortalDetector::DetectCaptivePortal(). // To run CaptivePortalDetector::DetectCaptivePortal().
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
CompleteURLFetch(net::OK, 204, NULL); CompleteURLFetch(net::OK, 204, nullptr);
ASSERT_FALSE(is_state_idle()); ASSERT_FALSE(is_state_idle());
ASSERT_EQ(0, no_response_result_count()); ASSERT_EQ(0, no_response_result_count());
CheckPortalState( CheckPortalState(
...@@ -675,17 +675,17 @@ TEST_F(NetworkPortalDetectorImplTest, ProxyAuthRequired) { ...@@ -675,17 +675,17 @@ TEST_F(NetworkPortalDetectorImplTest, ProxyAuthRequired) {
set_delay_till_next_attempt(base::TimeDelta()); set_delay_till_next_attempt(base::TimeDelta());
SetConnected(kStubWireless1); SetConnected(kStubWireless1);
CompleteURLFetch(net::OK, 407, NULL); CompleteURLFetch(net::OK, 407, nullptr);
ASSERT_EQ(1, no_response_result_count()); ASSERT_EQ(1, no_response_result_count());
ASSERT_TRUE(is_state_portal_detection_pending()); ASSERT_TRUE(is_state_portal_detection_pending());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
CompleteURLFetch(net::OK, 407, NULL); CompleteURLFetch(net::OK, 407, nullptr);
ASSERT_EQ(2, no_response_result_count()); ASSERT_EQ(2, no_response_result_count());
ASSERT_TRUE(is_state_portal_detection_pending()); ASSERT_TRUE(is_state_portal_detection_pending());
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
CompleteURLFetch(net::OK, 407, NULL); CompleteURLFetch(net::OK, 407, nullptr);
ASSERT_EQ(3, no_response_result_count()); ASSERT_EQ(3, no_response_result_count());
ASSERT_FALSE(is_state_idle()); ASSERT_FALSE(is_state_idle());
...@@ -708,24 +708,24 @@ TEST_F(NetworkPortalDetectorImplTest, NoResponseButBehindPortal) { ...@@ -708,24 +708,24 @@ TEST_F(NetworkPortalDetectorImplTest, NoResponseButBehindPortal) {
SetBehindPortal(kStubWireless1); SetBehindPortal(kStubWireless1);
ASSERT_TRUE(is_state_checking_for_portal()); ASSERT_TRUE(is_state_checking_for_portal());
CompleteURLFetch( CompleteURLFetch(net::ERR_CONNECTION_CLOSED,
net::ERR_CONNECTION_CLOSED, net::URLFetcher::RESPONSE_CODE_INVALID, NULL); net::URLFetcher::RESPONSE_CODE_INVALID, nullptr);
ASSERT_EQ(1, no_response_result_count()); ASSERT_EQ(1, no_response_result_count());
ASSERT_TRUE(is_state_portal_detection_pending()); ASSERT_TRUE(is_state_portal_detection_pending());
// To run CaptivePortalDetector::DetectCaptivePortal(). // To run CaptivePortalDetector::DetectCaptivePortal().
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
CompleteURLFetch( CompleteURLFetch(net::ERR_CONNECTION_CLOSED,
net::ERR_CONNECTION_CLOSED, net::URLFetcher::RESPONSE_CODE_INVALID, NULL); net::URLFetcher::RESPONSE_CODE_INVALID, nullptr);
ASSERT_EQ(2, no_response_result_count()); ASSERT_EQ(2, no_response_result_count());
ASSERT_TRUE(is_state_portal_detection_pending()); ASSERT_TRUE(is_state_portal_detection_pending());
// To run CaptivePortalDetector::DetectCaptivePortal(). // To run CaptivePortalDetector::DetectCaptivePortal().
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
CompleteURLFetch( CompleteURLFetch(net::ERR_CONNECTION_CLOSED,
net::ERR_CONNECTION_CLOSED, net::URLFetcher::RESPONSE_CODE_INVALID, NULL); net::URLFetcher::RESPONSE_CODE_INVALID, nullptr);
ASSERT_EQ(3, no_response_result_count()); ASSERT_EQ(3, no_response_result_count());
ASSERT_FALSE(is_state_idle()); ASSERT_FALSE(is_state_idle());
...@@ -761,7 +761,7 @@ TEST_F(NetworkPortalDetectorImplTest, ErrorScreenStrategyForOnlineNetwork) { ...@@ -761,7 +761,7 @@ TEST_F(NetworkPortalDetectorImplTest, ErrorScreenStrategyForOnlineNetwork) {
enable_error_screen_strategy(); enable_error_screen_strategy();
// To run CaptivePortalDetector::DetectCaptivePortal(). // To run CaptivePortalDetector::DetectCaptivePortal().
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
CompleteURLFetch(net::OK, 204, NULL); CompleteURLFetch(net::OK, 204, nullptr);
ASSERT_TRUE(is_state_portal_detection_pending()); ASSERT_TRUE(is_state_portal_detection_pending());
CheckPortalState( CheckPortalState(
...@@ -770,7 +770,7 @@ TEST_F(NetworkPortalDetectorImplTest, ErrorScreenStrategyForOnlineNetwork) { ...@@ -770,7 +770,7 @@ TEST_F(NetworkPortalDetectorImplTest, ErrorScreenStrategyForOnlineNetwork) {
// To run CaptivePortalDetector::DetectCaptivePortal(). // To run CaptivePortalDetector::DetectCaptivePortal().
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
CompleteURLFetch(net::OK, 204, NULL); CompleteURLFetch(net::OK, 204, nullptr);
ASSERT_TRUE(is_state_portal_detection_pending()); ASSERT_TRUE(is_state_portal_detection_pending());
CheckPortalState( CheckPortalState(
...@@ -785,7 +785,7 @@ TEST_F(NetworkPortalDetectorImplTest, ErrorScreenStrategyForOnlineNetwork) { ...@@ -785,7 +785,7 @@ TEST_F(NetworkPortalDetectorImplTest, ErrorScreenStrategyForOnlineNetwork) {
// To run CaptivePortalDetector::DetectCaptivePortal(). // To run CaptivePortalDetector::DetectCaptivePortal().
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
ASSERT_TRUE(is_state_checking_for_portal()); ASSERT_TRUE(is_state_checking_for_portal());
CompleteURLFetch(net::OK, 204, NULL); CompleteURLFetch(net::OK, 204, nullptr);
CheckPortalState( CheckPortalState(
NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE, 204, kStubWireless1); NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE, 204, kStubWireless1);
...@@ -803,8 +803,8 @@ TEST_F(NetworkPortalDetectorImplTest, ErrorScreenStrategyForPortalNetwork) { ...@@ -803,8 +803,8 @@ TEST_F(NetworkPortalDetectorImplTest, ErrorScreenStrategyForPortalNetwork) {
enable_error_screen_strategy(); enable_error_screen_strategy();
SetConnected(kStubWireless1); SetConnected(kStubWireless1);
CompleteURLFetch( CompleteURLFetch(net::ERR_CONNECTION_CLOSED,
net::ERR_CONNECTION_CLOSED, net::URLFetcher::RESPONSE_CODE_INVALID, NULL); net::URLFetcher::RESPONSE_CODE_INVALID, nullptr);
ASSERT_EQ(1, no_response_result_count()); ASSERT_EQ(1, no_response_result_count());
ASSERT_TRUE(is_state_portal_detection_pending()); ASSERT_TRUE(is_state_portal_detection_pending());
CheckPortalState( CheckPortalState(
...@@ -813,8 +813,8 @@ TEST_F(NetworkPortalDetectorImplTest, ErrorScreenStrategyForPortalNetwork) { ...@@ -813,8 +813,8 @@ TEST_F(NetworkPortalDetectorImplTest, ErrorScreenStrategyForPortalNetwork) {
// To run CaptivePortalDetector::DetectCaptivePortal(). // To run CaptivePortalDetector::DetectCaptivePortal().
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
CompleteURLFetch( CompleteURLFetch(net::ERR_CONNECTION_CLOSED,
net::ERR_CONNECTION_CLOSED, net::URLFetcher::RESPONSE_CODE_INVALID, NULL); net::URLFetcher::RESPONSE_CODE_INVALID, nullptr);
ASSERT_EQ(2, no_response_result_count()); ASSERT_EQ(2, no_response_result_count());
ASSERT_TRUE(is_state_portal_detection_pending()); ASSERT_TRUE(is_state_portal_detection_pending());
CheckPortalState( CheckPortalState(
...@@ -823,7 +823,7 @@ TEST_F(NetworkPortalDetectorImplTest, ErrorScreenStrategyForPortalNetwork) { ...@@ -823,7 +823,7 @@ TEST_F(NetworkPortalDetectorImplTest, ErrorScreenStrategyForPortalNetwork) {
// To run CaptivePortalDetector::DetectCaptivePortal(). // To run CaptivePortalDetector::DetectCaptivePortal().
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
CompleteURLFetch(net::OK, 200, NULL); CompleteURLFetch(net::OK, 200, nullptr);
ASSERT_EQ(0, no_response_result_count()); ASSERT_EQ(0, no_response_result_count());
ASSERT_TRUE(is_state_portal_detection_pending()); ASSERT_TRUE(is_state_portal_detection_pending());
CheckPortalState( CheckPortalState(
...@@ -872,7 +872,7 @@ TEST_F(NetworkPortalDetectorImplTest, TestDetectionRestart) { ...@@ -872,7 +872,7 @@ TEST_F(NetworkPortalDetectorImplTest, TestDetectionRestart) {
ASSERT_TRUE(is_state_checking_for_portal()); ASSERT_TRUE(is_state_checking_for_portal());
ASSERT_FALSE(start_detection_if_idle()); ASSERT_FALSE(start_detection_if_idle());
CompleteURLFetch(net::OK, 204, NULL); CompleteURLFetch(net::OK, 204, nullptr);
CheckPortalState( CheckPortalState(
NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE, 204, kStubWireless1); NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE, 204, kStubWireless1);
...@@ -883,7 +883,7 @@ TEST_F(NetworkPortalDetectorImplTest, TestDetectionRestart) { ...@@ -883,7 +883,7 @@ TEST_F(NetworkPortalDetectorImplTest, TestDetectionRestart) {
base::RunLoop().RunUntilIdle(); base::RunLoop().RunUntilIdle();
ASSERT_TRUE(is_state_checking_for_portal()); ASSERT_TRUE(is_state_checking_for_portal());
CompleteURLFetch(net::OK, 200, NULL); CompleteURLFetch(net::OK, 200, nullptr);
CheckPortalState( CheckPortalState(
NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL, 200, kStubWireless1); NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_PORTAL, 200, kStubWireless1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment