Include the implemented header first in all projects.

The Google C++ style guide dictates that foo.cc and foo_unittest.cc
should include foo.h in the first place, so missing headers in foo.h
are detected with a compile error of the module implementing them and
not when another module uses them.

This CL sweeps across all the .cc file in platform2 enforcing this.

BUG=None
TEST=cbuildbot amd64-generic

Change-Id: I41835835caba13f54c3c844ecf552eb0e47efa9d
Reviewed-on: https://chromium-review.googlesource.com/228894
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/connection_unittest.cc b/connection_unittest.cc
index 034fcec..3fc1da9 100644
--- a/connection_unittest.cc
+++ b/connection_unittest.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/connection.h"
+
 #include <arpa/inet.h>
 #include <linux/rtnetlink.h>
 
@@ -12,7 +14,6 @@
 #include <gtest/gtest.h>
 #include <gmock/gmock.h>
 
-#include "shill/connection.h"
 #include "shill/ipconfig.h"
 #include "shill/mock_connection.h"
 #include "shill/mock_control.h"
diff --git a/crypto_des_cbc_unittest.cc b/crypto_des_cbc_unittest.cc
index 74e86f3..c65a288 100644
--- a/crypto_des_cbc_unittest.cc
+++ b/crypto_des_cbc_unittest.cc
@@ -2,13 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/crypto_des_cbc.h"
+
 #include <string>
 
 #include <base/files/file_util.h>
 #include <base/files/scoped_temp_dir.h>
 #include <gtest/gtest.h>
 
-#include "shill/crypto_des_cbc.h"
 #include "shill/glib.h"
 
 using base::FilePath;
diff --git a/crypto_provider_unittest.cc b/crypto_provider_unittest.cc
index b77dc67..7108bf2 100644
--- a/crypto_provider_unittest.cc
+++ b/crypto_provider_unittest.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/crypto_provider.h"
+
 #include <string>
 
 #include <base/files/file_util.h>
@@ -9,7 +11,6 @@
 #include <gtest/gtest.h>
 
 #include "shill/crypto_des_cbc.h"
-#include "shill/crypto_provider.h"
 #include "shill/crypto_rot47.h"
 #include "shill/glib.h"
 
diff --git a/crypto_rot47_unittest.cc b/crypto_rot47_unittest.cc
index 1e88932..47409dc 100644
--- a/crypto_rot47_unittest.cc
+++ b/crypto_rot47_unittest.cc
@@ -2,12 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/crypto_rot47.h"
+
 #include <string>
 
 #include <gtest/gtest.h>
 
-#include "shill/crypto_rot47.h"
-
 using std::string;
 using testing::Test;
 
diff --git a/crypto_util_proxy_unittest.cc b/crypto_util_proxy_unittest.cc
index 0872622..afb159d 100644
--- a/crypto_util_proxy_unittest.cc
+++ b/crypto_util_proxy_unittest.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/crypto_util_proxy.h"
+
 #include <algorithm>
 #include <string>
 #include <vector>
@@ -12,7 +14,6 @@
 #include <gtest/gtest.h>
 
 #include "shill/callbacks.h"
-#include "shill/crypto_util_proxy.h"
 #include "shill/mock_crypto_util_proxy.h"
 #include "shill/mock_event_dispatcher.h"
 #include "shill/mock_file_io.h"
diff --git a/dbus_adaptor.cc b/dbus_adaptor.cc
index 124beb7..f73090e 100644
--- a/dbus_adaptor.cc
+++ b/dbus_adaptor.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/dbus_adaptor.h"
+
 #include <map>
 #include <string>
 #include <vector>
@@ -11,7 +13,6 @@
 #include <dbus-c++/dbus.h>
 
 #include "shill/accessor_interface.h"
-#include "shill/dbus_adaptor.h"
 #include "shill/error.h"
 #include "shill/key_value_store.h"
 #include "shill/logging.h"
diff --git a/mobile_operator_info_unittest.cc b/mobile_operator_info_unittest.cc
index 502e0d6..df4bded 100644
--- a/mobile_operator_info_unittest.cc
+++ b/mobile_operator_info_unittest.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/mobile_operator_info.h"
+
 #include <fstream>
 #include <map>
 #include <ostream>
@@ -26,7 +28,6 @@
 
 #include "shill/event_dispatcher.h"
 #include "shill/logging.h"
-#include "shill/mobile_operator_info.h"
 #include "shill/mobile_operator_info_impl.h"
 
 using base::FilePath;
diff --git a/mock_dns_server_tester.cc b/mock_dns_server_tester.cc
index 9f5232b..54955e8 100644
--- a/mock_dns_server_tester.cc
+++ b/mock_dns_server_tester.cc
@@ -2,11 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/mock_dns_server_tester.h"
+
 #include <string>
 #include <vector>
 
 #include "shill/connection.h"
-#include "shill/mock_dns_server_tester.h"
 
 namespace shill {
 
diff --git a/modem_info_unittest.cc b/modem_info_unittest.cc
index 9a5e42a..9530c21 100644
--- a/modem_info_unittest.cc
+++ b/modem_info_unittest.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/modem_info.h"
+
 #include <base/stl_util.h>
 #include <gtest/gtest.h>
 
@@ -11,7 +13,6 @@
 #include "shill/mock_glib.h"
 #include "shill/mock_manager.h"
 #include "shill/mock_metrics.h"
-#include "shill/modem_info.h"
 #include "shill/modem_manager.h"
 
 using testing::_;
diff --git a/modem_manager_unittest.cc b/modem_manager_unittest.cc
index 82ea6b3..b578a83 100644
--- a/modem_manager_unittest.cc
+++ b/modem_manager_unittest.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/modem_manager.h"
+
 #include <base/stl_util.h>
 #include <ModemManager/ModemManager.h>
 
@@ -15,7 +17,6 @@
 #include "shill/mock_modem_manager_proxy.h"
 #include "shill/mock_proxy_factory.h"
 #include "shill/modem.h"
-#include "shill/modem_manager.h"
 #include "shill/testing.h"
 
 using std::string;
diff --git a/net/byte_string_unittest.cc b/net/byte_string_unittest.cc
index 87aa7c3..dd24214 100644
--- a/net/byte_string_unittest.cc
+++ b/net/byte_string_unittest.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/net/byte_string.h"
+
 #include <arpa/inet.h>
 #include <endian.h>
 
@@ -9,8 +11,6 @@
 
 #include <string>
 
-#include "shill/net/byte_string.h"
-
 using testing::Test;
 using std::string;
 
diff --git a/net/ip_address_unittest.cc b/net/ip_address_unittest.cc
index 1c1d6ec..0cc6dbc 100644
--- a/net/ip_address_unittest.cc
+++ b/net/ip_address_unittest.cc
@@ -2,12 +2,13 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/net/ip_address.h"
+
 #include <gtest/gtest.h>
 
 #include <arpa/inet.h>
 
 #include "shill/net/byte_string.h"
-#include "shill/net/ip_address.h"
 
 using std::string;
 using testing::Test;
diff --git a/net/rtnl_handler.cc b/net/rtnl_handler.cc
index 59c831b..7382706 100644
--- a/net/rtnl_handler.cc
+++ b/net/rtnl_handler.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/net/rtnl_handler.h"
+
 #include <arpa/inet.h>
 #include <errno.h>
 #include <fcntl.h>
@@ -22,7 +24,6 @@
 #include "shill/net/io_handler.h"
 #include "shill/net/ip_address.h"
 #include "shill/net/ndisc.h"
-#include "shill/net/rtnl_handler.h"
 #include "shill/net/rtnl_listener.h"
 #include "shill/net/rtnl_message.h"
 #include "shill/net/sockets.h"
diff --git a/net/rtnl_handler_unittest.cc b/net/rtnl_handler_unittest.cc
index bf4611a..a3bfc95 100644
--- a/net/rtnl_handler_unittest.cc
+++ b/net/rtnl_handler_unittest.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/net/rtnl_handler.h"
+
 #include <string>
 
 #include <gtest/gtest.h>
@@ -15,7 +17,6 @@
 
 #include "shill/net/mock_io_handler_factory.h"
 #include "shill/net/mock_sockets.h"
-#include "shill/net/rtnl_handler.h"
 #include "shill/net/rtnl_message.h"
 
 using base::Bind;
diff --git a/net/rtnl_listener_unittest.cc b/net/rtnl_listener_unittest.cc
index 268c9ae..9964e11 100644
--- a/net/rtnl_listener_unittest.cc
+++ b/net/rtnl_listener_unittest.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/net/rtnl_listener.h"
+
 #include <linux/netlink.h>
 #include <sys/socket.h>
 
@@ -10,7 +12,6 @@
 #include <gtest/gtest.h>
 
 #include "shill/net/rtnl_handler.h"
-#include "shill/net/rtnl_listener.h"
 #include "shill/net/rtnl_message.h"
 
 using base::Bind;
diff --git a/net/rtnl_message_unittest.cc b/net/rtnl_message_unittest.cc
index bb90427..5a8f99f 100644
--- a/net/rtnl_message_unittest.cc
+++ b/net/rtnl_message_unittest.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/net/rtnl_message.h"
+
 #include <sys/socket.h>
 #include <linux/if.h>  // NOLINT(build/include_alpha) - needs sockaddr.
 #include <linux/netlink.h>
@@ -13,7 +15,6 @@
 
 #include "shill/net/byte_string.h"
 #include "shill/net/ip_address.h"
-#include "shill/net/rtnl_message.h"
 
 using std::string;
 using testing::Test;
diff --git a/property_store_unittest.cc b/property_store_unittest.cc
index f0bb0f1..e1fc17c 100644
--- a/property_store_unittest.cc
+++ b/property_store_unittest.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/property_store.h"
+
 #include "shill/property_store_unittest.h"
 
 #include <map>
@@ -21,7 +23,6 @@
 #include "shill/manager.h"
 #include "shill/mock_control.h"
 #include "shill/property_accessor.h"
-#include "shill/property_store.h"
 
 using base::Bind;
 using base::Unretained;
diff --git a/routing_table_unittest.cc b/routing_table_unittest.cc
index b28851e..4034764 100644
--- a/routing_table_unittest.cc
+++ b/routing_table_unittest.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/routing_table.h"
+
 #include <linux/rtnetlink.h>
 #include <sys/socket.h>
 
@@ -22,7 +24,6 @@
 #include "shill/net/byte_string.h"
 #include "shill/net/mock_rtnl_handler.h"
 #include "shill/net/rtnl_message.h"
-#include "shill/routing_table.h"
 #include "shill/routing_table_entry.h"
 
 using base::Bind;
diff --git a/scope_logger_unittest.cc b/scope_logger_unittest.cc
index 60ff2a5..acdf593 100644
--- a/scope_logger_unittest.cc
+++ b/scope_logger_unittest.cc
@@ -2,11 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/scope_logger.h"
+
 #include <base/bind.h>
 #include <base/memory/weak_ptr.h>
 
 #include "shill/logging.h"
-#include "shill/scope_logger.h"
 
 #include <gmock/gmock.h>
 #include <gtest/gtest.h>
diff --git a/traffic_monitor_unittest.cc b/traffic_monitor_unittest.cc
index 61dda3b..98a335a 100644
--- a/traffic_monitor_unittest.cc
+++ b/traffic_monitor_unittest.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/traffic_monitor.h"
+
 #include <string>
 #include <vector>
 
-#include "shill/traffic_monitor.h"
-
 #include <base/bind.h>
 #include <base/strings/stringprintf.h>
 #include <gtest/gtest.h>
diff --git a/vpn_driver_unittest.cc b/vpn_driver_unittest.cc
index 98f494d..d83646e 100644
--- a/vpn_driver_unittest.cc
+++ b/vpn_driver_unittest.cc
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <vector>
-
 #include "shill/vpn_driver.h"
 
+#include <vector>
+
 #include <base/stl_util.h>
 #include <base/strings/string_number_conversions.h>
 #include <chromeos/dbus/service_constants.h>
diff --git a/vpn_provider_unittest.cc b/vpn_provider_unittest.cc
index 19f5ced..b8beaee 100644
--- a/vpn_provider_unittest.cc
+++ b/vpn_provider_unittest.cc
@@ -2,11 +2,11 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/vpn_provider.h"
+
 #include <memory>
 #include <set>
 
-#include "shill/vpn_provider.h"
-
 #include <chromeos/dbus/service_constants.h>
 #include <gtest/gtest.h>
 
diff --git a/vpn_service_unittest.cc b/vpn_service_unittest.cc
index b224b42..6b91600 100644
--- a/vpn_service_unittest.cc
+++ b/vpn_service_unittest.cc
@@ -2,10 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include <string>
-
 #include "shill/vpn_service.h"
 
+#include <string>
+
 #include <chromeos/dbus/service_constants.h>
 #include <gtest/gtest.h>
 
diff --git a/wake_on_wifi_unittest.cc b/wake_on_wifi_unittest.cc
index 26ca522..f0dcd30 100644
--- a/wake_on_wifi_unittest.cc
+++ b/wake_on_wifi_unittest.cc
@@ -2,6 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include "shill/wake_on_wifi.h"
+
 #include <linux/nl80211.h>
 #include <netlink/netlink.h>
 
@@ -27,7 +29,6 @@
 #include "shill/net/nl80211_message.h"
 #include "shill/nice_mock_control.h"
 #include "shill/testing.h"
-#include "shill/wake_on_wifi.h"
 
 using std::set;
 using std::string;