shill: vpn: Don't auto-connect to a VPN service that has never connected.
This improves the chances that the VPN service is connectable.
BUG=chromium-os:38193
TEST=unit test
Change-Id: I5d505604aaa3fd30cb89c2a87de398544d5a1c27
Reviewed-on: https://gerrit.chromium.org/gerrit/41927
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Paul Stewart <pstew@chromium.org>
Reviewed-by: Philipp Neubeck <pneubeck@chromium.org>
Tested-by: Philipp Neubeck <pneubeck@chromium.org>
Commit-Queue: Darin Petkov <petkov@chromium.org>
diff --git a/vpn_service.h b/vpn_service.h
index 1162e57..4a6bc9b 100644
--- a/vpn_service.h
+++ b/vpn_service.h
@@ -43,10 +43,17 @@
Error *error);
void set_storage_id(const std::string &id) { storage_id_ = id; }
+ protected:
+ // Inherited from Service.
+ virtual bool IsAutoConnectable(const char **reason) const;
+
private:
FRIEND_TEST(VPNServiceTest, GetDeviceRpcId);
+ FRIEND_TEST(VPNServiceTest, IsAutoConnectable);
FRIEND_TEST(VPNServiceTest, SetConnection);
+ static const char kAutoConnNeverConnected[];
+
virtual std::string GetDeviceRpcId(Error *error);
std::string storage_id_;