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/buffet/commands/command_definition_unittest.cc b/buffet/commands/command_definition_unittest.cc index 76212af..f0adab1 100644 --- a/buffet/commands/command_definition_unittest.cc +++ b/buffet/commands/command_definition_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 <gtest/gtest.h> - #include "buffet/commands/command_definition.h" +#include <gtest/gtest.h> + TEST(CommandDefinition, Test) { auto params = std::make_shared<buffet::ObjectSchema>(); buffet::CommandDefinition def("powerd", params);
diff --git a/buffet/commands/command_dictionary_unittest.cc b/buffet/commands/command_dictionary_unittest.cc index d4c4ab1..20c1287 100644 --- a/buffet/commands/command_dictionary_unittest.cc +++ b/buffet/commands/command_dictionary_unittest.cc
@@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "buffet/commands/command_dictionary.h" + #include <gtest/gtest.h> -#include "buffet/commands/command_dictionary.h" #include "buffet/commands/unittest_utils.h" using buffet::unittests::CreateDictionaryValue;
diff --git a/buffet/commands/command_instance_unittest.cc b/buffet/commands/command_instance_unittest.cc index 56c9023..b57de25 100644 --- a/buffet/commands/command_instance_unittest.cc +++ b/buffet/commands/command_instance_unittest.cc
@@ -2,10 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "buffet/commands/command_instance.h" + #include <gtest/gtest.h> #include "buffet/commands/command_dictionary.h" -#include "buffet/commands/command_instance.h" #include "buffet/commands/prop_types.h" #include "buffet/commands/unittest_utils.h"
diff --git a/buffet/commands/command_manager_unittest.cc b/buffet/commands/command_manager_unittest.cc index 4c103dc..37e3716 100644 --- a/buffet/commands/command_manager_unittest.cc +++ b/buffet/commands/command_manager_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 "buffet/commands/command_manager.h" + #include <base/files/file_util.h> #include <base/json/json_writer.h> #include <gtest/gtest.h> -#include "buffet/commands/command_manager.h" #include "buffet/commands/unittest_utils.h" using buffet::unittests::CreateDictionaryValue;
diff --git a/buffet/commands/command_queue.cc b/buffet/commands/command_queue.cc index d16d15f..d660a1d 100644 --- a/buffet/commands/command_queue.cc +++ b/buffet/commands/command_queue.cc
@@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "buffet/commands/command_dispatch_interface.h" #include "buffet/commands/command_queue.h" +#include "buffet/commands/command_dispatch_interface.h" + namespace buffet { void CommandQueue::Add(std::unique_ptr<CommandInstance> instance) {
diff --git a/buffet/commands/command_queue_unittest.cc b/buffet/commands/command_queue_unittest.cc index 8fe0c9d..bea01c5 100644 --- a/buffet/commands/command_queue_unittest.cc +++ b/buffet/commands/command_queue_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 "buffet/commands/command_queue.h" + #include <set> #include <string> #include <vector> @@ -10,7 +12,6 @@ #include <gtest/gtest.h> #include "buffet/commands/command_dispatch_interface.h" -#include "buffet/commands/command_queue.h" namespace {
diff --git a/buffet/commands/dbus_command_dispatcher_unittest.cc b/buffet/commands/dbus_command_dispatcher_unittest.cc index 314135f..f11dd56 100644 --- a/buffet/commands/dbus_command_dispatcher_unittest.cc +++ b/buffet/commands/dbus_command_dispatcher_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 "buffet/commands/dbus_command_dispatcher.h" + #include <memory> #include <string> @@ -14,7 +16,6 @@ #include "buffet/commands/command_dictionary.h" #include "buffet/commands/command_queue.h" -#include "buffet/commands/dbus_command_dispatcher.h" #include "buffet/commands/unittest_utils.h" #include "buffet/libbuffet/dbus_constants.h"
diff --git a/buffet/commands/dbus_command_proxy_unittest.cc b/buffet/commands/dbus_command_proxy_unittest.cc index 0c1bbaa..94b4906 100644 --- a/buffet/commands/dbus_command_proxy_unittest.cc +++ b/buffet/commands/dbus_command_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 "buffet/commands/dbus_command_proxy.h" + #include <functional> #include <memory> @@ -14,7 +16,6 @@ #include "buffet/commands/command_dictionary.h" #include "buffet/commands/command_instance.h" -#include "buffet/commands/dbus_command_proxy.h" #include "buffet/commands/unittest_utils.h" #include "buffet/libbuffet/dbus_constants.h"
diff --git a/buffet/commands/object_schema_unittest.cc b/buffet/commands/object_schema_unittest.cc index e802a67..505d6a6 100644 --- a/buffet/commands/object_schema_unittest.cc +++ b/buffet/commands/object_schema_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 "buffet/commands/object_schema.h" + #include <algorithm> #include <limits> #include <memory> @@ -12,7 +14,6 @@ #include <base/values.h> #include <gtest/gtest.h> -#include "buffet/commands/object_schema.h" #include "buffet/commands/prop_types.h" #include "buffet/commands/schema_constants.h" #include "buffet/commands/unittest_utils.h" @@ -928,4 +929,3 @@ EXPECT_EQ("unexpected_parameter", error->GetFirstError()->GetCode()); error.reset(); } -
diff --git a/buffet/commands/prop_constraints.cc b/buffet/commands/prop_constraints.cc index d44700d..641d0f6 100644 --- a/buffet/commands/prop_constraints.cc +++ b/buffet/commands/prop_constraints.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include "buffet/commands/prop_constraints.h" + #include "buffet/commands/prop_values.h" #include "buffet/commands/schema_constants.h"
diff --git a/buffet/commands/schema_utils_unittest.cc b/buffet/commands/schema_utils_unittest.cc index ffa05a6..4d0b90a 100644 --- a/buffet/commands/schema_utils_unittest.cc +++ b/buffet/commands/schema_utils_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 "buffet/commands/schema_utils.h" + #include <memory> #include <string> #include <vector> @@ -14,7 +16,6 @@ #include "buffet/commands/prop_types.h" #include "buffet/commands/prop_values.h" #include "buffet/commands/schema_constants.h" -#include "buffet/commands/schema_utils.h" #include "buffet/commands/unittest_utils.h" using buffet::unittests::CreateDictionaryValue;
diff --git a/buffet/device_registration_info_unittest.cc b/buffet/device_registration_info_unittest.cc index f333078..1ab5191 100644 --- a/buffet/device_registration_info_unittest.cc +++ b/buffet/device_registration_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 "buffet/device_registration_info.h" + #include <base/json/json_reader.h> #include <base/values.h> #include <chromeos/bind_lambda.h> @@ -12,7 +14,6 @@ #include "buffet/commands/command_manager.h" #include "buffet/commands/unittest_utils.h" -#include "buffet/device_registration_info.h" #include "buffet/device_registration_storage_keys.h" #include "buffet/states/mock_state_change_queue_interface.h" #include "buffet/states/state_manager.h"
diff --git a/buffet/states/state_change_queue.cc b/buffet/states/state_change_queue.cc index 663d799..f7775ba 100644 --- a/buffet/states/state_change_queue.cc +++ b/buffet/states/state_change_queue.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 <base/logging.h> - #include "buffet/states/state_change_queue.h" +#include <base/logging.h> + namespace buffet { StateChangeQueue::StateChangeQueue(size_t max_queue_size)
diff --git a/buffet/states/state_change_queue_unittest.cc b/buffet/states/state_change_queue_unittest.cc index 7aa6c9f..01f5f9f 100644 --- a/buffet/states/state_change_queue_unittest.cc +++ b/buffet/states/state_change_queue_unittest.cc
@@ -3,10 +3,10 @@ // found in the LICENSE file. -#include <gtest/gtest.h> - #include "buffet/states/state_change_queue.h" +#include <gtest/gtest.h> + namespace buffet { class StateChangeQueueTest : public ::testing::Test {
diff --git a/buffet/states/state_manager_unittest.cc b/buffet/states/state_manager_unittest.cc index df2260a..bdfad8c 100644 --- a/buffet/states/state_manager_unittest.cc +++ b/buffet/states/state_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 "buffet/states/state_manager.h" + #include <cstdlib> // for abs(). #include <vector> @@ -13,7 +15,6 @@ #include "buffet/commands/unittest_utils.h" #include "buffet/states/error_codes.h" #include "buffet/states/mock_state_change_queue_interface.h" -#include "buffet/states/state_manager.h" using buffet::unittests::CreateDictionaryValue; using buffet::unittests::ValueToString;
diff --git a/buffet/states/state_package_unittest.cc b/buffet/states/state_package_unittest.cc index d8dc907..9d5b0d6 100644 --- a/buffet/states/state_package_unittest.cc +++ b/buffet/states/state_package_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 "buffet/states/state_package.h" + #include <memory> #include <string> @@ -12,7 +14,6 @@ #include "buffet/commands/schema_constants.h" #include "buffet/commands/unittest_utils.h" #include "buffet/states/error_codes.h" -#include "buffet/states/state_package.h" using buffet::unittests::CreateDictionaryValue; using buffet::unittests::ValueToString;