diff options
author | Alex Deymo <deymo@chromium.org> | 2014-11-10 19:55:35 -0800 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-11-12 19:56:58 +0000 |
commit | aab50e31f0b80ed53a9b8d5dbabcf943974bd32c (patch) | |
tree | df2ac7ac92e6eb5dfc24c87af119eb6cb3ee65fb | |
parent | e89487039d0eca8130d822cabf75a729609509e0 (diff) |
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>
30 files changed, 57 insertions, 30 deletions
diff --git a/action_pipe_unittest.cc b/action_pipe_unittest.cc index 0f777fb3..3cdd03d1 100644 --- a/action_pipe_unittest.cc +++ b/action_pipe_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 "update_engine/action_pipe.h" + #include <string> #include <gtest/gtest.h> #include "update_engine/action.h" -#include "update_engine/action_pipe.h" using std::string; diff --git a/action_processor_unittest.cc b/action_processor_unittest.cc index cde1eecd..64e847d9 100644 --- a/action_processor_unittest.cc +++ b/action_processor_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 "update_engine/action_processor.h" + #include <string> #include <gtest/gtest.h> #include "update_engine/action.h" -#include "update_engine/action_processor.h" using std::string; diff --git a/action_unittest.cc b/action_unittest.cc index 4ab51667..a5f7b11e 100644 --- a/action_unittest.cc +++ b/action_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 "update_engine/action.h" + #include <string> #include <gtest/gtest.h> -#include "update_engine/action.h" #include "update_engine/action_processor.h" using std::string; @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "update_engine/bzip.h" + #include <stdlib.h> #include <algorithm> #include <bzlib.h> diff --git a/bzip_extent_writer_unittest.cc b/bzip_extent_writer_unittest.cc index 96121d4c..0aa8709f 100644 --- a/bzip_extent_writer_unittest.cc +++ b/bzip_extent_writer_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 "update_engine/bzip_extent_writer.h" + #include <sys/stat.h> #include <sys/types.h> #include <unistd.h> @@ -9,7 +11,6 @@ #include <string> #include <vector> #include <gtest/gtest.h> -#include "update_engine/bzip_extent_writer.h" #include "update_engine/test_utils.h" #include "update_engine/utils.h" diff --git a/chrome_browser_proxy_resolver_unittest.cc b/chrome_browser_proxy_resolver_unittest.cc index 3974f3bc..d3cf99ee 100644 --- a/chrome_browser_proxy_resolver_unittest.cc +++ b/chrome_browser_proxy_resolver_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 "update_engine/chrome_browser_proxy_resolver.h" + #include <deque> #include <string> #include <gtest/gtest.h> -#include "update_engine/chrome_browser_proxy_resolver.h" #include "update_engine/mock_dbus_wrapper.h" using ::testing::Return; diff --git a/download_action.cc b/download_action.cc index f37828b0..35b11743 100644 --- a/download_action.cc +++ b/download_action.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "update_engine/download_action.h" + #include <errno.h> #include <algorithm> #include <string> diff --git a/extent_ranges_unittest.cc b/extent_ranges_unittest.cc index 11b17edf..b4de3bc8 100644 --- a/extent_ranges_unittest.cc +++ b/extent_ranges_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 "update_engine/extent_ranges.h" + #include <vector> #include <gtest/gtest.h> -#include "update_engine/extent_ranges.h" #include "update_engine/payload_constants.h" #include "update_engine/test_utils.h" diff --git a/file_writer.cc b/file_writer.cc index ad298448..8f8e9891 100644 --- a/file_writer.cc +++ b/file_writer.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include "update_engine/file_writer.h" + #include <errno.h> namespace chromeos_update_engine { diff --git a/filesystem_copier_action_unittest.cc b/filesystem_copier_action_unittest.cc index c551adf0..5c40fb3f 100644 --- a/filesystem_copier_action_unittest.cc +++ b/filesystem_copier_action_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 "update_engine/filesystem_copier_action.h" + #include <fcntl.h> #include <set> @@ -16,7 +18,6 @@ #include <gtest/gtest.h> #include "update_engine/fake_system_state.h" -#include "update_engine/filesystem_copier_action.h" #include "update_engine/mock_hardware.h" #include "update_engine/omaha_hash_calculator.h" #include "update_engine/test_utils.h" diff --git a/multi_range_http_fetcher.cc b/multi_range_http_fetcher.cc index 19263de6..63b85c9f 100644 --- a/multi_range_http_fetcher.cc +++ b/multi_range_http_fetcher.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 "update_engine/multi_range_http_fetcher.h" + #include <base/strings/stringprintf.h> #include <algorithm> #include <string> -#include "update_engine/multi_range_http_fetcher.h" #include "update_engine/utils.h" namespace chromeos_update_engine { diff --git a/omaha_hash_calculator_unittest.cc b/omaha_hash_calculator_unittest.cc index 762a528a..08e8698e 100644 --- a/omaha_hash_calculator_unittest.cc +++ b/omaha_hash_calculator_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 "update_engine/omaha_hash_calculator.h" + #include <math.h> #include <unistd.h> @@ -12,7 +14,6 @@ #include <gtest/gtest.h> #include "update_engine/libcurl_http_fetcher.h" -#include "update_engine/omaha_hash_calculator.h" #include "update_engine/utils.h" using std::string; diff --git a/omaha_response_handler_action_unittest.cc b/omaha_response_handler_action_unittest.cc index 418383ae..fb99ddb3 100644 --- a/omaha_response_handler_action_unittest.cc +++ b/omaha_response_handler_action_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 "update_engine/omaha_response_handler_action.h" + #include <string> #include <gtest/gtest.h> @@ -9,7 +11,6 @@ #include "update_engine/constants.h" #include "update_engine/fake_system_state.h" #include "update_engine/mock_payload_state.h" -#include "update_engine/omaha_response_handler_action.h" #include "update_engine/test_utils.h" #include "update_engine/utils.h" diff --git a/payload_generator/full_update_generator_unittest.cc b/payload_generator/full_update_generator_unittest.cc index 559a110c..95a40aee 100644 --- a/payload_generator/full_update_generator_unittest.cc +++ b/payload_generator/full_update_generator_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 "update_engine/payload_generator/full_update_generator.h" + #include <string> #include <vector> #include <gtest/gtest.h> -#include "update_engine/payload_generator/full_update_generator.h" #include "update_engine/test_utils.h" using chromeos_update_engine::test_utils::FillWithData; diff --git a/payload_generator/graph_utils_unittest.cc b/payload_generator/graph_utils_unittest.cc index 0aed78d8..c96927fd 100644 --- a/payload_generator/graph_utils_unittest.cc +++ b/payload_generator/graph_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 "update_engine/payload_generator/graph_utils.h" + #include <utility> #include <vector> @@ -9,7 +11,6 @@ #include "update_engine/extent_ranges.h" #include "update_engine/payload_constants.h" -#include "update_engine/payload_generator/graph_utils.h" using std::make_pair; using std::vector; diff --git a/payload_generator/metadata.cc b/payload_generator/metadata.cc index 0b4e428f..4e0265a9 100644 --- a/payload_generator/metadata.cc +++ b/payload_generator/metadata.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 "update_engine/payload_generator/metadata.h" + #include <algorithm> #include <string> #include <vector> @@ -17,7 +19,6 @@ #include "update_engine/payload_generator/delta_diff_generator.h" #include "update_engine/payload_generator/ext2_utils.h" #include "update_engine/payload_generator/graph_utils.h" -#include "update_engine/payload_generator/metadata.h" #include "update_engine/utils.h" using base::StringPrintf; diff --git a/payload_generator/metadata_unittest.cc b/payload_generator/metadata_unittest.cc index 2ffb338c..6bc56b72 100644 --- a/payload_generator/metadata_unittest.cc +++ b/payload_generator/metadata_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 "update_engine/payload_generator/metadata.h" + #include <ext2fs/ext2fs.h> #include <fcntl.h> #include <sys/stat.h> @@ -16,7 +18,6 @@ #include "update_engine/payload_generator/delta_diff_generator.h" #include "update_engine/payload_generator/graph_types.h" -#include "update_engine/payload_generator/metadata.h" #include "update_engine/test_utils.h" #include "update_engine/utils.h" diff --git a/payload_generator/topological_sort_unittest.cc b/payload_generator/topological_sort_unittest.cc index c1d19b75..e5e7477c 100644 --- a/payload_generator/topological_sort_unittest.cc +++ b/payload_generator/topological_sort_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 "update_engine/payload_generator/topological_sort.h" + #include <utility> #include <vector> #include <gtest/gtest.h> #include "update_engine/payload_generator/graph_types.h" -#include "update_engine/payload_generator/topological_sort.h" using std::make_pair; using std::vector; diff --git a/prefs_unittest.cc b/prefs_unittest.cc index 0c81b921..18633e10 100644 --- a/prefs_unittest.cc +++ b/prefs_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 "update_engine/prefs.h" + #include <inttypes.h> #include <string> @@ -12,8 +14,6 @@ #include <base/strings/stringprintf.h> #include <gtest/gtest.h> -#include "update_engine/prefs.h" - using std::string; namespace chromeos_update_engine { diff --git a/subprocess_unittest.cc b/subprocess_unittest.cc index 7fafd9ea..4e7ebf61 100644 --- a/subprocess_unittest.cc +++ b/subprocess_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 "update_engine/subprocess.h" + #include <fcntl.h> #include <netinet/in.h> #include <netinet/ip.h> @@ -20,7 +22,6 @@ #include <glib.h> #include <gtest/gtest.h> -#include "update_engine/subprocess.h" #include "update_engine/test_utils.h" #include "update_engine/utils.h" diff --git a/terminator_unittest.cc b/terminator_unittest.cc index 0096c0cf..5e6b2e0d 100644 --- a/terminator_unittest.cc +++ b/terminator_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 "update_engine/terminator.h" + #include <gtest/gtest.h> #include <gtest/gtest-spi.h> -#include "update_engine/terminator.h" - using testing::ExitedWithCode; namespace chromeos_update_engine { diff --git a/update_manager/boxed_value.cc b/update_manager/boxed_value.cc index 2307f8d9..0acc8cd2 100644 --- a/update_manager/boxed_value.cc +++ b/update_manager/boxed_value.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 "update_engine/update_manager/boxed_value.h" + #include <stdint.h> #include <set> @@ -10,7 +12,6 @@ #include <base/strings/string_number_conversions.h> #include <base/time/time.h> -#include "update_engine/update_manager/boxed_value.h" #include "update_engine/update_manager/shill_provider.h" #include "update_engine/update_manager/updater_provider.h" #include "update_engine/utils.h" diff --git a/update_manager/boxed_value_unittest.cc b/update_manager/boxed_value_unittest.cc index 77b44c26..62f4bfea 100644 --- a/update_manager/boxed_value_unittest.cc +++ b/update_manager/boxed_value_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 "update_engine/update_manager/boxed_value.h" + #include <gtest/gtest.h> #include <list> #include <map> @@ -11,7 +13,6 @@ #include <base/strings/stringprintf.h> #include <base/time/time.h> -#include "update_engine/update_manager/boxed_value.h" #include "update_engine/update_manager/shill_provider.h" #include "update_engine/update_manager/umtest_utils.h" #include "update_engine/update_manager/updater_provider.h" diff --git a/update_manager/evaluation_context_unittest.cc b/update_manager/evaluation_context_unittest.cc index f38b6417..c5cc8839 100644 --- a/update_manager/evaluation_context_unittest.cc +++ b/update_manager/evaluation_context_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 "update_engine/update_manager/evaluation_context.h" + #include <memory> #include <string> @@ -10,7 +12,6 @@ #include "update_engine/fake_clock.h" #include "update_engine/test_utils.h" -#include "update_engine/update_manager/evaluation_context.h" #include "update_engine/update_manager/fake_variable.h" #include "update_engine/update_manager/generic_variables.h" #include "update_engine/update_manager/mock_variable.h" diff --git a/update_manager/real_random_provider.cc b/update_manager/real_random_provider.cc index ea10de60..47cb31d4 100644 --- a/update_manager/real_random_provider.cc +++ b/update_manager/real_random_provider.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 "update_engine/update_manager/real_random_provider.h" + #include <stdio.h> #include <unistd.h> @@ -11,7 +13,6 @@ #include <base/files/scoped_file.h> #include <base/strings/stringprintf.h> -#include "update_engine/update_manager/real_random_provider.h" #include "update_engine/update_manager/variable.h" using std::string; diff --git a/update_manager/real_random_provider_unittest.cc b/update_manager/real_random_provider_unittest.cc index d7dfeb2c..0deba4c0 100644 --- a/update_manager/real_random_provider_unittest.cc +++ b/update_manager/real_random_provider_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 "update_engine/update_manager/real_random_provider.h" + #include <gtest/gtest.h> #include <memory> -#include "update_engine/update_manager/real_random_provider.h" #include "update_engine/update_manager/umtest_utils.h" using std::unique_ptr; diff --git a/update_manager/real_shill_provider_unittest.cc b/update_manager/real_shill_provider_unittest.cc index b384e670..641a5c3a 100644 --- a/update_manager/real_shill_provider_unittest.cc +++ b/update_manager/real_shill_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 "update_engine/update_manager/real_shill_provider.h" + #include <memory> #include <utility> @@ -13,7 +15,6 @@ #include "update_engine/fake_clock.h" #include "update_engine/mock_dbus_wrapper.h" #include "update_engine/test_utils.h" -#include "update_engine/update_manager/real_shill_provider.h" #include "update_engine/update_manager/umtest_utils.h" using base::Time; diff --git a/update_manager/real_time_provider_unittest.cc b/update_manager/real_time_provider_unittest.cc index 3532ff36..7e27a4e4 100644 --- a/update_manager/real_time_provider_unittest.cc +++ b/update_manager/real_time_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 "update_engine/update_manager/real_time_provider.h" + #include <memory> #include <base/logging.h> @@ -9,7 +11,6 @@ #include <gtest/gtest.h> #include "update_engine/fake_clock.h" -#include "update_engine/update_manager/real_time_provider.h" #include "update_engine/update_manager/umtest_utils.h" using base::Time; diff --git a/update_manager/umtest_utils.cc b/update_manager/umtest_utils.cc index 41dc0a63..be6a86f7 100644 --- a/update_manager/umtest_utils.cc +++ b/update_manager/umtest_utils.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/time/time.h> - #include "update_engine/update_manager/umtest_utils.h" +#include <base/time/time.h> + namespace chromeos_update_manager { const unsigned UmTestUtils::kDefaultTimeoutInSeconds = 1; diff --git a/update_manager/update_manager_unittest.cc b/update_manager/update_manager_unittest.cc index c0ce0925..1d79c5c2 100644 --- a/update_manager/update_manager_unittest.cc +++ b/update_manager/update_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 "update_engine/update_manager/update_manager.h" + #include <unistd.h> #include <algorithm> @@ -22,7 +24,6 @@ #include "update_engine/update_manager/fake_state.h" #include "update_engine/update_manager/mock_policy.h" #include "update_engine/update_manager/umtest_utils.h" -#include "update_engine/update_manager/update_manager.h" using base::Bind; using base::Callback; |