summaryrefslogtreecommitdiff
path: root/certificate_checker_unittest.cc
AgeCommit message (Collapse)Author
2019-01-16update_engine: Run clang-format on ./ (root directory)Amin Hassani
BUG=none TEST=unittest Change-Id: Ibd075dc7ea9a18e798f612e35725f1c83c112809 Reviewed-on: https://chromium-review.googlesource.com/1409708 Commit-Ready: Amin Hassani <ahassani@chromium.org> Tested-by: Amin Hassani <ahassani@chromium.org> Reviewed-by: Sen Jiang <senj@chromium.org>
2017-10-24update_engine: replace testing::SetArgumentPointee with testing::SetArgPointeeBen Chan
testing::SetArgumentPointee defined in gmock has been deprecated and superseded by an equivalent testing::SetArgPointee. BUG=chromium:777011 TEST=Run unit tests. Change-Id: Ifc48897148d721e6f65159a54586e1fb456d75b9 Reviewed-on: https://chromium-review.googlesource.com/735213 Commit-Ready: Ben Chan <benchan@chromium.org> Tested-by: Ben Chan <benchan@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
2016-07-28Remove libcurl support from update_engine_sideload.Alex Deymo
While sideloading an update from recovery we don't need nor want to download payload from HTTP(S) URLs, only local file:// are supported. This patch moves libcurl_http_fetcher and certificate_checker files out of libpayload_consumer dropping the libcurl and libssl dependencies from it and the update_engine_sideload. Bug: 27178350 TEST=build UE for Brillo and Android. Unittests still pass and update_engine_sideload doesn't link to libcurl. Change-Id: Iffefdb094654f7277dc825c041fe55aac9ee8756
2015-11-12Split payload application code into a subdirectory.Alex Deymo
This patch splits from the main libupdate_engine code the part that is strictly used to download and apply a payload into a new static library, moving the code to subdirectories. The new library is divided in two subdirectories: common/ and payload_consumer/, and should not depend on other update_engine files outside those two subdirectories. The main difference between those two is that the common/ tools are more generic and not tied to the payload consumer process, but otherwise they are both compiled together. There are still dependencies from the new libpayload_consumer library into the main directory files and DBus generated files. Those will be addressed in follow up CLs. Bug: 25197634 Test: FEATURES=test emerge-link update_engine; `mm` on Brillo. Change-Id: Id8d0204ea573627e6e26ca9ea17b9592ca95bc23
2015-08-19Re-license update_engine to Apache2Alex Deymo
This patch automatically replaced the license on all text files from Chromium OS (BSD style) to AOSP (Apache2), keeping the original year as a reference. The license header was added to .gyp and .gypi files, the NOTICE was replaced with a copy of the Apache2 license and MODULE_LICENSE_* file was updated. BUG=b/23084294 TEST=grep 'Chromium OS Authors' doesn't find anything. Change-Id: Ie5083750755f5180a8a785b24fe67dbf9195cd10
2015-02-11update_engine: replace std::vector<char> with chromeos::BlobAlex Vakulenko
To make update engine consistent with the rest of platform2 code replaced std::vector<char> as the container of binary data with chromeos::Blob. BUG=None TEST=`FEATURES=test emerge-link update_engine` Change-Id: I6385fd2257d15aa24bfa74ac35512c2a06c33012 Reviewed-on: https://chromium-review.googlesource.com/247793 Reviewed-by: Gilad Arnold <garnold@chromium.org> Reviewed-by: Alex Deymo <deymo@chromium.org> Tested-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
2014-11-13update_engine: Add override when possible.Alex Deymo
Google Style Guide requires to include the "override" keyword when overriding a method on a derived class, so the compiler will catch errors if the method is not overriding a member of the base class. This patch introduces the "override" keyword when possible. BUG=None TEST=FEATURES=test emerge-link update_engine Change-Id: Ie83d115c5730f3b35b3d95859a54bc1a48e0be7b Reviewed-on: https://chromium-review.googlesource.com/228928 Tested-by: Alex Deymo <deymo@chromium.org> Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org>
2014-11-06update_engine: Standarize mock/fake filenames.Alex Deymo
Mock classes implement mostly MOCK_METHOD* methods used with gmock. Those classes should be named with the prefix "Mock" in the class name and "mock_" in the header filename. Fake classes implement a working version of the interface they provide, often with extra functionality to change their behavior. Those classes should be prefixed with "Fake" in the class name and "fake_" in the file name. Other minor include order fixes are included in this patch. BUG=None TEST=Unittest still pass. Change-Id: I23de7cb11e25182d5855afacca47d431c97b82bb Reviewed-on: https://chromium-review.googlesource.com/227779 Reviewed-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org>
2014-11-01update_engine: Fix all the "using" declaration usage.Alex Deymo
This patch removes unused "using" declarations, that is, declarations included in a .cc file at a global scope such that "using foo::bar" that later don't use the identifier "bar" at all. This also unifies the usage of these identifiers in the .cc files in favor of using the short name defined by the using declaration. For example, in several cases the .h refer to a type like "std::string" because using declarations are forbidden in header files while the .cc includes "using std::string;" with the purpose of just writting "string" in the .cc file. Very rarely, the full identifier is used when a local name ocludes it, for example, StringVectorToGStrv() and StringVectorToString() in utils.cc named its argument just "vector" need to refer to std::vector with the full name. This patch renames those arguments instead. Finally, it also sorts a few lists of using declarations that weren't in order. BUG=None TEST=FEATURES=test emerge-link update_engine Change-Id: I30f6b9510ecb7e03640f1951c48d5bb106309840 Reviewed-on: https://chromium-review.googlesource.com/226423 Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Alex Deymo <deymo@chromium.org> Tested-by: Alex Deymo <deymo@chromium.org>
2014-09-01update_engine: Replace NULL with nullptrAlex Vakulenko
Replaced the usage of NULL with nullptr. This also makes it possible to use standard gtest macros to compare pointers in Update Manager's unit tests. So, there is no need in custom UMTEST_... macros which are replaced with the gtest macros (see change in update_engine/update_manager/umtest_utils.h): UMTEST_ASSERT_NULL(p) => ASSERT_EQ(nullptr, p) UMTEST_ASSERT_NOT_NULL(p) => ASSERT_NE(nullptr, p) UMTEST_EXPECT_NULL(p) => EXPECT_EQ(nullptr, p) UMTEST_EXPECT_NOT_NULL(p) => EXPECT_NE(nullptr, p) BUG=None TEST=FEATURES=test emerge-link update_engine USE="clang asan" FEATURES=test emerge-link update_engine Change-Id: I77a42a1e9ce992bb2f9f263db5cf75fe6110a4ec Reviewed-on: https://chromium-review.googlesource.com/215136 Tested-by: Alex Vakulenko <avakulenko@chromium.org> Reviewed-by: Alex Deymo <deymo@chromium.org> Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
2014-06-18update_engine: fixed warnings from cpplintAlex Vakulenko
Fixed all the cpplint warnings in update engine. BUG=None TEST=Unit tests still pass. Change-Id: I285ae858eec8abe0b26ff203b99a42a200ceb71c Reviewed-on: https://chromium-review.googlesource.com/204027 Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Tested-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
2014-04-15Rename MockSystemState into FakeSystemState.Gilad Arnold
This class is no longer a mock. The change also includes renaming the appropriate files and the instances of this class. BUG=chromium:358278 TEST=Unit tests. Change-Id: Ifc20ead0d624eddf8827a6e6f39cd9b9207dcabf Reviewed-on: https://chromium-review.googlesource.com/194088 Reviewed-by: Gilad Arnold <garnold@chromium.org> Tested-by: Gilad Arnold <garnold@chromium.org> Commit-Queue: David Zeuthen <zeuthen@chromium.org>
2014-03-27update_engine: update to libbase 242728Alex Vakulenko
Made update_engine link with libchrome-242728 and fixed compile issues due to changes in namespaces and include file layout. Also removed some of suppressed compiler warnings and fixed the issues masked by them (e.g. mismatched printf-like specifiers). Added -Wextra compiler option to enable additional useful warnings to ensure more strict checking... Had to disable "unused-parameter" though since we have a lot of functions (mainly in fakes) that do not use all of their parameters. BUG=chromium:351593 TEST=Unit tests passed. CQ-DEPEND=CL:191721 Change-Id: I1aa63a48d5f1f4ea75ba6b00aec7aa5f3bad15c4 Reviewed-on: https://chromium-review.googlesource.com/191510 Reviewed-by: Alex Vakulenko <avakulenko@chromium.org> Commit-Queue: Alex Vakulenko <avakulenko@chromium.org> Tested-by: Alex Vakulenko <avakulenko@chromium.org>
2013-04-09Refactoring: Move prefs constants out to the constants.h/ccJay Srinivasan
Adding/removing the set of keys used by various parts of the Update Engine code does not affect the implementation of the prefs module, hence separating them. BUG=chromium:229090 TEST=Unit tests pass. Change-Id: Id774b726a47b461e563e2e413527054e4da0c012 Reviewed-on: https://gerrit.chromium.org/gerrit/47593 Reviewed-by: Gilad Arnold <garnold@chromium.org> Tested-by: Jay Srinivasan <jaysri@chromium.org> Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
2012-12-16Support for processing multiple URLs in update_engine.Jay Srinivasan
Main changes: 1. Added a new PayloadState class which encapsulates all the persisted state we use for multiple URLs, back-off (TBD), etc. 2. Added support for handling multiple URLs stored in the OmahaResponse in OmahaRequestAction and OmahaResponseHandlerAction code. 3. Added support for picking the right URL in OmahaResponseHandlerAction and putting it in the install_plan. This way, the rest of the code that uses the install_plan is oblivious to the presence of multiple URLs :-) 4. Added support for advancing to next URL when an update fails. The full error classification is a new work item (chromium-os:37206). Right now, it's a basic round-robin on every error. 5. Updated the conditions for determining when hash checks are mandatory. Previously since there was only one URL, if it was HTTPS, the checks were waived. Now, even if there's one HTTP URL, we make hash checks mandatory even if other HTTPS URLs are present. 6. Added new unit tests for PayloadState and the new logic added to other places. Noisy changes: 1. Instead of passing PrefsInterface to OmahaRequestAction and OmahaResponseHandlerAction, we're now passing SystemState which will now contain PrefsInterface and the newly added PayloadState object that these actions need to do their work. 2. Renamed a bunch of setters/getters to set_x() and x() instead of SetX() and GetX() methods - this was pending from Gilad's old CR. As I'm adding new methods in the correct style, I went ahead and fixed it to avoid the confusing styles. 3. Updated all existing unit tests to reflect these changes. BUG=chromium-os:36807 TEST=All Single/Multiple URL scenarios work fine on my ZGB as expected. TEST=Old and new unit tests run fine. Change-Id: Id31f9ccb220471f3ec3a475f624dc03c16119144 Reviewed-on: https://gerrit.chromium.org/gerrit/39638 Commit-Ready: Jay Srinivasan <jaysri@chromium.org> Reviewed-by: Jay Srinivasan <jaysri@chromium.org> Tested-by: Jay Srinivasan <jaysri@chromium.org>
2012-04-11pull in base/stringprintf.h explicitlyMike Frysinger
Newer libbase no longer implicitly includes the stringprintf.h header, so building against it fails with missing StringPrintf definitions. BUG=chromium-os:25872 TEST=`emerge-x86-alex update_engine` works with old & new libbase Change-Id: Ia1ea842449c0382ee4c8e5abd3ddfb3012c3ff2f Reviewed-on: https://gerrit.chromium.org/gerrit/19774 Commit-Ready: Mike Frysinger <vapier@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org>
2011-09-15Add UMA metrics for detecting and reporting update certificate changes.Bruno Rocha
LibcurlHttpFetcher checks if the update server certificate has changed since last update, and stores an eventual report in prefs. UpdateCheckScheduler submits to UMA reports from the previous update. BUG=chromium-os:19842 TEST=Included unittest for the new class and tested locally on an Alex device, since we need to verify against the actual server certificates. Change-Id: I5bee5d648982cd7618db09b67d5bff377eaa1fc1 Reviewed-on: http://gerrit.chromium.org/gerrit/7565 Reviewed-by: Bruno Pontes Soares Rocha <bpontes@chromium.org> Tested-by: Bruno Pontes Soares Rocha <bpontes@chromium.org> Reviewed-by: Andrew de los Reyes <adlr@chromium.org> Reviewed-by: Darin Petkov <petkov@chromium.org>