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