apmanager: store config files under /var/run/apmanager

This prevents non-root/apmanager users from modifying the files generated
by apmanager.

Also add a wrapper class for base::WriteFile to prevent any file writes
during unittest.

BUG=chromium:446679
TEST=USE="asan clang" FEATURES=test emerge-$BOARD apmanager
     Start an AP service using apmanager, verify hostapd and dhcp server
     config files are store in "/var/run/apmanager/hostapd" and
     "/var/run/apmanager/dnsmasq" respectively.

Change-Id: I2bf2d34a8c95c9493f2cf5d5eb4895fefcdae8dc
Reviewed-on: https://chromium-review.googlesource.com/239632
Reviewed-by: Paul Stewart <pstew@chromium.org>
Commit-Queue: Zeping Qiu <zqiu@chromium.org>
Trybot-Ready: Zeping Qiu <zqiu@chromium.org>
Tested-by: Zeping Qiu <zqiu@chromium.org>
diff --git a/service.h b/service.h
index 7dd7bd2..9caf65b 100644
--- a/service.h
+++ b/service.h
@@ -13,6 +13,7 @@
 #include "apmanager/config.h"
 #include "apmanager/dbus_adaptors/org.chromium.apmanager.Service.h"
 #include "apmanager/dhcp_server_factory.h"
+#include "apmanager/file_writer.h"
 
 namespace apmanager {
 
@@ -67,6 +68,7 @@
   std::unique_ptr<chromeos::Process> hostapd_process_;
   std::unique_ptr<DHCPServer> dhcp_server_;
   DHCPServerFactory* dhcp_server_factory_;
+  FileWriter* file_writer_;
 
   DISALLOW_COPY_AND_ASSIGN(Service);
 };