Commit bae8e191 authored by Steven Bennetts's avatar Steven Bennetts Committed by Commit Bot

CrOS NetworkPortalDetector: Elim unused argument to StartPortalDetection

This argument was used with networking.config which has been deprecated.
|force| is always false in the remaining calls.

Bug: 1124419
Change-Id: Ic920385fc2364a04dabccfec13171f8759b8b522
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2442897
Commit-Queue: Steven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarAchuith Bhandarkar <achuith@chromium.org>
Reviewed-by: default avatarKartik Hegde <khegde@chromium.org>
Cr-Commit-Position: refs/heads/master@{#816362}
parent 1005ad99
...@@ -124,8 +124,7 @@ void AutoEnrollmentCheckScreen::ShowImpl() { ...@@ -124,8 +124,7 @@ void AutoEnrollmentCheckScreen::ShowImpl() {
} else { } else {
auto_enrollment_controller_->Start(); auto_enrollment_controller_->Start();
} }
network_portal_detector::GetInstance()->StartPortalDetection( network_portal_detector::GetInstance()->StartPortalDetection();
false /* force */);
} }
void AutoEnrollmentCheckScreen::HideImpl() {} void AutoEnrollmentCheckScreen::HideImpl() {}
......
...@@ -301,8 +301,7 @@ void VersionUpdater::OnPortalDetectionCompleted( ...@@ -301,8 +301,7 @@ void VersionUpdater::OnPortalDetectionCompleted(
is_first_detection_notification_ = false; is_first_detection_notification_ = false;
base::ThreadTaskRunnerHandle::Get()->PostTask( base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::BindOnce([]() { FROM_HERE, base::BindOnce([]() {
network_portal_detector::GetInstance()->StartPortalDetection( network_portal_detector::GetInstance()->StartPortalDetection();
false /* force */);
})); }));
return; return;
} }
......
...@@ -97,7 +97,7 @@ NetworkPortalDetectorImpl::NetworkPortalDetectorImpl( ...@@ -97,7 +97,7 @@ NetworkPortalDetectorImpl::NetworkPortalDetectorImpl(
content::NotificationService::AllSources()); content::NotificationService::AllSources());
NetworkHandler::Get()->network_state_handler()->AddObserver(this, FROM_HERE); NetworkHandler::Get()->network_state_handler()->AddObserver(this, FROM_HERE);
StartPortalDetection(false /* force */); StartPortalDetection();
} }
NetworkPortalDetectorImpl::~NetworkPortalDetectorImpl() { NetworkPortalDetectorImpl::~NetworkPortalDetectorImpl() {
...@@ -173,14 +173,11 @@ NetworkPortalDetectorImpl::GetCaptivePortalState(const std::string& guid) { ...@@ -173,14 +173,11 @@ NetworkPortalDetectorImpl::GetCaptivePortalState(const std::string& guid) {
return it->second; return it->second;
} }
bool NetworkPortalDetectorImpl::StartPortalDetection(bool force) { void NetworkPortalDetectorImpl::StartPortalDetection() {
if (!is_idle()) { if (!is_idle())
if (!force) return;
return false;
StopDetection();
}
StartDetection(); StartDetection();
return true; return;
} }
void NetworkPortalDetectorImpl::SetStrategy( void NetworkPortalDetectorImpl::SetStrategy(
...@@ -188,7 +185,9 @@ void NetworkPortalDetectorImpl::SetStrategy( ...@@ -188,7 +185,9 @@ void NetworkPortalDetectorImpl::SetStrategy(
if (id == strategy_->Id()) if (id == strategy_->Id())
return; return;
strategy_ = PortalDetectorStrategy::CreateById(id, this); strategy_ = PortalDetectorStrategy::CreateById(id, this);
StartPortalDetection(true /* force */); if (!is_idle())
StopDetection();
StartPortalDetection();
} }
void NetworkPortalDetectorImpl::DefaultNetworkChanged( void NetworkPortalDetectorImpl::DefaultNetworkChanged(
......
...@@ -100,7 +100,7 @@ class NetworkPortalDetectorImpl : public NetworkPortalDetector, ...@@ -100,7 +100,7 @@ class NetworkPortalDetectorImpl : public NetworkPortalDetector,
CaptivePortalState GetCaptivePortalState(const std::string& guid) override; CaptivePortalState GetCaptivePortalState(const std::string& guid) override;
bool IsEnabled() override; bool IsEnabled() override;
void Enable(bool start_detection) override; void Enable(bool start_detection) override;
bool StartPortalDetection(bool force) override; void StartPortalDetection() override;
void SetStrategy(PortalDetectorStrategy::StrategyId id) override; void SetStrategy(PortalDetectorStrategy::StrategyId id) override;
// NetworkStateHandlerObserver implementation: // NetworkStateHandlerObserver implementation:
......
...@@ -169,8 +169,8 @@ class NetworkPortalDetectorImplTest ...@@ -169,8 +169,8 @@ class NetworkPortalDetectorImplTest
return network_portal_detector()->state(); return network_portal_detector()->state();
} }
bool StartPortalDetection(bool force) { void StartPortalDetection() {
return network_portal_detector()->StartPortalDetection(force); network_portal_detector()->StartPortalDetection();
} }
void enable_error_screen_strategy() { void enable_error_screen_strategy() {
...@@ -771,7 +771,7 @@ TEST_F(NetworkPortalDetectorImplTest, TestDetectionRestart) { ...@@ -771,7 +771,7 @@ TEST_F(NetworkPortalDetectorImplTest, TestDetectionRestart) {
// First portal detection attempts determines ONLINE state. // First portal detection attempts determines ONLINE state.
SetConnected(kStubWireless1); SetConnected(kStubWireless1);
ASSERT_EQ(State::STATE_CHECKING_FOR_PORTAL, state()); ASSERT_EQ(State::STATE_CHECKING_FOR_PORTAL, state());
ASSERT_FALSE(StartPortalDetection(false /* force */)); StartPortalDetection();
CompleteURLFetch(net::OK, 204, nullptr); CompleteURLFetch(net::OK, 204, nullptr);
......
...@@ -103,9 +103,9 @@ bool NetworkPortalDetectorTestImpl::IsEnabled() { ...@@ -103,9 +103,9 @@ bool NetworkPortalDetectorTestImpl::IsEnabled() {
void NetworkPortalDetectorTestImpl::Enable(bool start_detection) { void NetworkPortalDetectorTestImpl::Enable(bool start_detection) {
} }
bool NetworkPortalDetectorTestImpl::StartPortalDetection(bool force) { void NetworkPortalDetectorTestImpl::StartPortalDetection() {
if (portal_detection_in_progress_ && !force) if (portal_detection_in_progress_)
return false; return;
portal_detection_in_progress_ = true; portal_detection_in_progress_ = true;
std::vector<base::OnceClosure> callbacks = std::vector<base::OnceClosure> callbacks =
...@@ -113,7 +113,7 @@ bool NetworkPortalDetectorTestImpl::StartPortalDetection(bool force) { ...@@ -113,7 +113,7 @@ bool NetworkPortalDetectorTestImpl::StartPortalDetection(bool force) {
for (auto& callback : callbacks) for (auto& callback : callbacks)
std::move(callback).Run(); std::move(callback).Run();
return true; return;
} }
void NetworkPortalDetectorTestImpl::SetStrategy( void NetworkPortalDetectorTestImpl::SetStrategy(
......
...@@ -43,7 +43,7 @@ class NetworkPortalDetectorTestImpl : public NetworkPortalDetector { ...@@ -43,7 +43,7 @@ class NetworkPortalDetectorTestImpl : public NetworkPortalDetector {
const std::string& service_path) override; const std::string& service_path) override;
bool IsEnabled() override; bool IsEnabled() override;
void Enable(bool start_detection) override; void Enable(bool start_detection) override;
bool StartPortalDetection(bool force) override; void StartPortalDetection() override;
void SetStrategy(PortalDetectorStrategy::StrategyId id) override; void SetStrategy(PortalDetectorStrategy::StrategyId id) override;
PortalDetectorStrategy::StrategyId strategy_id() const { PortalDetectorStrategy::StrategyId strategy_id() const {
......
...@@ -26,7 +26,7 @@ class MockNetworkPortalDetector : public NetworkPortalDetector { ...@@ -26,7 +26,7 @@ class MockNetworkPortalDetector : public NetworkPortalDetector {
const std::string& service_path)); const std::string& service_path));
MOCK_METHOD0(IsEnabled, bool()); MOCK_METHOD0(IsEnabled, bool());
MOCK_METHOD1(Enable, void(bool start_detection)); MOCK_METHOD1(Enable, void(bool start_detection));
MOCK_METHOD1(StartPortalDetection, bool(bool force)); MOCK_METHOD0(StartPortalDetection, void());
MOCK_METHOD1(SetStrategy, MOCK_METHOD1(SetStrategy,
void(chromeos::PortalDetectorStrategy::StrategyId id)); void(chromeos::PortalDetectorStrategy::StrategyId id));
......
...@@ -97,10 +97,9 @@ class COMPONENT_EXPORT(CHROMEOS_NETWORK) NetworkPortalDetector { ...@@ -97,10 +97,9 @@ class COMPONENT_EXPORT(CHROMEOS_NETWORK) NetworkPortalDetector {
virtual void Enable(bool start_detection) = 0; virtual void Enable(bool start_detection) = 0;
// Starts or restarts portal detection for the default network. If not // Starts or restarts portal detection for the default network. If not
// currently in the idle state, does nothing unless |force| is true in which // currently in the idle state, does nothing. Returns true if a new portal
// case any current detection is stopped and a new attempt is started. Returns // detection attempt was started.
// true if a new portal detection attempt was started. virtual void StartPortalDetection() = 0;
virtual bool StartPortalDetection(bool force) = 0;
// Sets current strategy according to |id|. If current detection id // Sets current strategy according to |id|. If current detection id
// doesn't equal to |id|, detection is restarted. // doesn't equal to |id|, detection is restarted.
......
...@@ -31,9 +31,7 @@ bool NetworkPortalDetectorStub::IsEnabled() { ...@@ -31,9 +31,7 @@ bool NetworkPortalDetectorStub::IsEnabled() {
void NetworkPortalDetectorStub::Enable(bool start_detection) {} void NetworkPortalDetectorStub::Enable(bool start_detection) {}
bool NetworkPortalDetectorStub::StartPortalDetection(bool force) { void NetworkPortalDetectorStub::StartPortalDetection() {}
return false;
}
void NetworkPortalDetectorStub::SetStrategy( void NetworkPortalDetectorStub::SetStrategy(
PortalDetectorStrategy::StrategyId id) {} PortalDetectorStrategy::StrategyId id) {}
......
...@@ -25,7 +25,7 @@ class COMPONENT_EXPORT(CHROMEOS_NETWORK) NetworkPortalDetectorStub ...@@ -25,7 +25,7 @@ class COMPONENT_EXPORT(CHROMEOS_NETWORK) NetworkPortalDetectorStub
const std::string& service_path) override; const std::string& service_path) override;
bool IsEnabled() override; bool IsEnabled() override;
void Enable(bool start_detection) override; void Enable(bool start_detection) override;
bool StartPortalDetection(bool force) override; void StartPortalDetection() override;
void SetStrategy(PortalDetectorStrategy::StrategyId id) override; void SetStrategy(PortalDetectorStrategy::StrategyId id) override;
DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorStub); DISALLOW_COPY_AND_ASSIGN(NetworkPortalDetectorStub);
......
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