History log of /system/update_engine/update_attempter_unittest.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
14fd1ec41d1da4e849b724b762ca111a30c6628c 25-Feb-2016 Alex Deymo <deymo@google.com> Allow to Suspend/Resume the ActionProcessor.

This patch implements the core functionality of suspend/resume actions
from the ActionProcessor. No actions support suspend/resume yet.

Bug: 27047026
TEST=Added unittets, tested on edison-eng.

Change-Id: Ib9600098dbccf05fc30f10f0add4a5bc87892b66
/system/update_engine/update_attempter_unittest.cc
80f70ff45f8ea9a679c0c3ed0dc143dd2fe2b63e 11-Feb-2016 Alex Deymo <deymo@google.com> Build unittests in Brillo.

Many unittests do not pass for simple reasons that will be addressed
later. This CL includes all the changes to make the unittests build.
In particular, the generated DBus mocks, required to build several
unittests are now included here.

The dbus-constants.h files were moved to the system_api repo, so they
can be removed from here.

The unittest build is only enabled for Brillo targets, since non-Brillo
targets don't even build DBus.

Bug: 26955860
TEST=`mmma` on edison-eng (and aosp_arm-eng).

Change-Id: Ib38241f0a6eb99b1d60d72db6bcfd125d38e3fad
/system/update_engine/update_attempter_unittest.cc
1b3556cbe66b3f5be35f6117d4013ddc199b064c 03-Feb-2016 Alex Deymo <deymo@google.com> Allow null SystemState in the DownloadAction.

The SystemState is only defined in the libupdate_engine library, so
it may not be defined for other users of libpayload_consumer. This
patch allows to pass a nullptr for the SystemState while explicitly
passing the other classes defined in libpayload_consumer upon
construction.

Bug: None
TEST=FEATURES=test emerge-link update_engine
TEST=`mmma system/update_engine` on aosp_arm-eng and edison-eng

Change-Id: I535d0184a85e0a167ac65875f6e7c07832efbf40
/system/update_engine/update_attempter_unittest.cc
ab0d976fa47844870d55c87ab530072cea0c8c53 02-Feb-2016 Alex Deymo <deymo@google.com> CPULimiter: Refactor class to manage the CPU limitation.

This new class replaces the functionality embedded in UpdateAttempter
that limits the max CPU usage allowed by update_engine. This refactor
helps reusing this class outside of the brillo UpdateAttempter.

Bug: None
TEST=FEATURES=test emerge-link update_engine

Change-Id: Ib5487d314846b497a44bb78a3b94609571e0fe38
/system/update_engine/update_attempter_unittest.cc
5a4c5130390f7433aa725996ad95043a0554707c 12-Dec-2015 Alex Deymo <deymo@google.com> Fix UpdateAttempter unittests.

The passed nullptr references are now used during Init(). This patch
fixes the unittests by properly initializing the UpdateAttempter
under test.

Bug: None
TEST=FEATURES=test emerge-link update_engine
TBR=garnold@google.com

Change-Id: I4c5fd979276775cc3ee92accbd2924b8508c4abd
/system/update_engine/update_attempter_unittest.cc
33e91e78bfe98c063b0c3b6d590976e275685686 01-Dec-2015 Alex Deymo <deymo@google.com> Fix certificate checker callback lifetime.

OpenSSL's SSL_CTX_set_verify() function allows us to set a callback
called after certificate validation but doesn't provide a way to pass
private data to this callback. CL:183832 was passing the pointer to the
CertificateChecker instance using a global pointer, nevertheless the
lifetime of this pointer was wrong since libcurl can trigger this
callback asynchronously when the SSL certificates are downloaded.

This patch converts the CertificateChecker into a singleton class and
uses the same trick previously used to pass the ServerToCheck value
using different callbacks.

Bug: 25818567
Test: Run an update on edison-userdebug; FEATURES=test emerge-link update_engine

Change-Id: I84cdb2f8c5ac86d1463634e73e867f213f7a2f5a
/system/update_engine/update_attempter_unittest.cc
b15a0b8eaf18c9e9341706df9f4ab59ce595a67c 26-Nov-2015 Alex Deymo <deymo@google.com> Remove SystemState from post-install step.

The post-install action only requires to mark the new slot as ready,
for which it was including a reference to the whole SystemState. This
patch removes said dependency replacing it for just the
BootControlInterface.

Bug: 25773375
TEST=FEATURES=test emerge-link update_engine; mma

Change-Id: I814d47c138c7565e9a80f316f25e124adb0d9c4e
/system/update_engine/update_attempter_unittest.cc
c1c17b4ed6a3896b6343e737fd89682fa0c8436b 23-Nov-2015 Alex Deymo <deymo@google.com> Report Enum metrics from CertificateChecker.

The certificate checker was reporting a "user action" whenever an
update check HTTPS connection or HTTPS payload download had an invalid
HTTPS certificate or a valid one that was changed since the last
connection to the same server.

This patch sends an Enum metric for every HTTPS connection to check for
and update or download the payload with one of the three options: an
invalid certificate, a valid one already seen or a valid but different
certificate.

This patch also moves these metrics to the metrics.{h,cc} module, where
all the other metrics are reported, using an observer pattern in the
CertificateChecker, needed to remove the dependency on the metrics
library from the libpayload_consumer.

Bug: 25818567
TEST=FEATURES=test emerge-link update_engine; mma;

Change-Id: Ia1b6eb799e13b439b520ba14549d8973e18bcbfa
/system/update_engine/update_attempter_unittest.cc
22ad86121ba56c576bfcaa23e085dab881bd4ff5 20-Nov-2015 Alex Deymo <deymo@google.com> Delete DownloadActionDelegate::SetDownloadStatus() method.

This method is only used by the caller to detect a programming error in
the DownloadAction (calling BytesReceived when not downloading) and log
a message. This patch removes the method from the delegate interface
and makes sure it doesn't issue a call to BytesReceived when not
activelly downloading.

Bug: 25773375
TEST=FEATURES=test emerge-link update_engine

Change-Id: I8ff5c53f1fd40c0777b3f6523703a8bee71c019d
/system/update_engine/update_attempter_unittest.cc
39910dcd1d68987ccee7c3031dc269233a8490bb 10-Nov-2015 Alex Deymo <deymo@google.com> Split payload application code into a subdirectory.

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
/system/update_engine/update_attempter_unittest.cc
110e030ba1a37787635e229bd36b42e33b9a9208 20-Oct-2015 Alex Deymo <deymo@google.com> Remove test_utils::RecursiveUnlinkDir().

This test-only function has an equivalent implementation in libcrhome
so we remove it from update_engine and use the library version instead.

Bug: None
Test: FEATURES=test emerge-link update_engine

Change-Id: I3027c879d40461dbdf8b52dd1b65da0240549c9c
/system/update_engine/update_attempter_unittest.cc
906191f88cb2448691e54f7a6a3b464854053154 12-Oct-2015 Alex Deymo <deymo@google.com> Base the update complete marker on persisted data.

The update complete marker was stored in /var/run, a fixed volatile
location. The marker would signal that an update was already applied
even after an update_engine crash and subsequent restart.

This location, while quite standard on the Unix FHS, is not
available in Android. This patch achieves the same goal by storing the
boot_id in the persisted prefs directory.

Bug: 24868648
Test: Unittests. Restarted update_engine after an update, keeps saying NEED_REBOOT.

Change-Id: I4dc2cbaeaeb0fd3197fa89168deaa042cb776d61
/system/update_engine/update_attempter_unittest.cc
3f39d5cc753905874d8d93bef94f857b8808f19e 13-Oct-2015 Alex Vakulenko <avakulenko@google.com> update_engine: Rename "chromeos" -> "brillo" in include paths and namespaces

libchromeos is transitioning to libbrillo and chromeos namespaces
and include directory is changing to brillo.

Bug: 24872993
Change-Id: I770659a95be380a50fe3b2ba9f91d65818f40945
/system/update_engine/update_attempter_unittest.cc
e5e5fe926e9ea45b1a381af1bee91a86643ffd72 05-Oct-2015 Alex Deymo <deymo@google.com> Move InstallPlan partitions to a list of partitions.

This patch changes the InstallPlan instance from having hard-coded
rootfs and kernel paritions to have a list of partitions with a
name, source and target information.

The FilesystemVerifierAction, DeltaPerformer and PostInstallAction were
adapter to use the list of partitions instead.

In delta payloads (only supported in the current major version 1) the
list of operations is still fixed: the rootfs first and the kernel.
This list is now populated by the FilesystemVerifierAction including
the size of these partitions, until the whole source partition hash
checking is deprecated (b/23182225).

The PostIntallAction now relies on the DeltaPerformer to populate the
post-install information from the payload. This means that in rollback
we won't run any device-specific post-install operation, and will
simply flip the slots in the bootloader.

Bug: 24667689
Test: Updated unittests. Tested on a dragonboard and a link.

Change-Id: I8277e3190ac74e57832a58dc0730e3713f48af8a
/system/update_engine/update_attempter_unittest.cc
6b6cc1b788af989fb64116fb2e2299abac697510 06-Oct-2015 Christopher Wiley <wiley@google.com> Rename UPDATE_STATUS_* enum values in tests

The update engine unittests on were broken when these
constants were renamed.

Bug: 24547247
Change-Id: Ibcc01c3cde22554d352b593b55f57b258a8dee54
Test: Build + ran unittests on Chrome OS
/system/update_engine/update_attempter_unittest.cc
70a6ab091beb261a501012bc09955de452dd4736 28-Aug-2015 Sen Jiang <senj@google.com> Move install operations to partitions field in major version 2.

install_operations and kernel_install_operations will be empty in major
version 2, they are now present in partitions field.

partition_info are still in old location, more refactoring are needed before
moving them.

This patch also moves the kLegancyPartitionName constants from install_plan.h
to payload_constants.h.

TEST=cros_generate_update_payload generate same payload version 1 as before.
Call delta_generator manually with --major_version=2, then cros payload show.
cros_workon_make update_engine --test

Bug: 23694580
Change-Id: If9e9531656480b1174e13b39af7ecb6a81060aac
/system/update_engine/update_attempter_unittest.cc
31d95ac85d294b2b1bfa293835013e66c010fbcf 17-Sep-2015 Alex Deymo <deymo@google.com> Mark the active slot from update_engine instead of /postinstall.

In Chrome OS, we were reliying on the /postinst script to generate the
verity hashes and mark the new kernel as bootable. This means that we
also need to run /postinst from the other (not verified) slot when
doing a user-initiated rollback. The update_engine already interacts
with the bootloader via the BootControlInterface to mark the other slot
as unbootable and check if there are other slots available for
rollback.

This patch moves the responsibility of marking the new slot as bootable
from the /postinst script to the update_engine, introducing a new
SetActiveBootSlot() method in the BootControlInterface. Chrome OS
builds will continue to mark the new slot as active from /postinstall
in order to be compatible with old builds, resulting in the new slot
marked as active twice during a successful normal update.

Bug: 23523562
Test: cros flash and image to the new daemon; rolled it back

Change-Id: I02502d7b8e85523a6eb9a7721053739e8381d266
/system/update_engine/update_attempter_unittest.cc
aa26f6240865d43f8cecc97bde7828f9b82bc17d 17-Sep-2015 Alex Deymo <deymo@google.com> Move MarkBootSuccessful to BootControlInterface.

Updating the boot flags to mark the current boot as successful is
platform-specific and part of the BootControlInterface's job. This
patch moves this to a new async method in this interface.

Bug: 24077637
Test: FEATURES=test emerge-link update_engine; cros flash in Chrome OS; tested on a dragonboard.

Change-Id: I23c3ed915dd8d2588a90d84b212bb04977957975
/system/update_engine/update_attempter_unittest.cc
ac41a82e4be1be43913292d13d58b5eb2c572f53 16-Sep-2015 Alex Deymo <deymo@google.com> Set default updater URL and version per platform.

Chrome OS and Brillo devices require different production update URL
and updater string ID sent to Omaha. This patch moves these constants
to a platform-dependent file with the definition of the constants.

Bug: brillo:587,brillo:588
Test: FEATURES=test emerge-link update_engine; `mma`; deployed on a dragonboard.

Change-Id: Ibe3b30c32c2fb2caf3ed10a4198272dc13a44d12
/system/update_engine/update_attempter_unittest.cc
d6deb1d0357f47d5525bfaeffa6c201b19abd3e7 29-Aug-2015 Alex Deymo <deymo@google.com> Use installed DBus libraries instead of generating them.

login_manager, power_manager, debugd and shill now expose a client
library with the generated dbus-proxies.h file and the system_api's
installed dbus-constants.h. This patch changes update_engine from
generating these DBus headers to use the installed client libraries.

The client libraries already include the service path string, so we
don't need to include system_api dbus-constants.h in most cases, unless
we actually use some parameter constants defined there.

BUG=b:23084776,b:23560718
TEST=./build_packages --board=link

Change-Id: Idb4501e784ebb5928c92902d114462be57d5826a
/system/update_engine/update_attempter_unittest.cc
763e7dbaac735da0ae802933a1015b6b7874bce2 28-Aug-2015 Alex Deymo <deymo@google.com> update_engine: New BootControlInterface class.

The new BootControlInterface class is a platform-independent
abstraction to control the bootloader. It provides methods for setting
what partition slots are available for booting and getting the
bootloader status about the available slots.

The Chrome OS specific implementation of the bootloader was moved to
the BootControlChromeOS which now depends on the vboot_host
implementation used in Chrome OS. Follow up CL will implement the
equivalent class for Brillo.

BUG=b:23010637
TEST=unittests; cros flash from the new image and rolled back from it.

Change-Id: I0a03aeeb8c21d8c99e1866b625e6e8c96628215b
/system/update_engine/update_attempter_unittest.cc
b8803bbfe96abce0ae792a93bc975d478d98d16a 20-Aug-2015 Alex Deymo <deymo@google.com> Split DBus client proxies into separated headers.

Each daemon we talk to should expose its own DBus library. This patch
splits the DBus proxies we generate from other daemon's .xml files into
separated header files so we can then replace them with libraries.

BUG=b:23084776
TEST=FEATURES=test emerge-link update_engine

Change-Id: Idbf1671eb7fc4259d493dbe2c8bcc8dad5b8784f
/system/update_engine/update_attempter_unittest.cc
aea4c1cea20dda7ae7e85fc8924a2d784f70d806 20-Aug-2015 Alex Deymo <deymo@google.com> Re-license update_engine to Apache2

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
/system/update_engine/update_attempter_unittest.cc
0b3db6b6040f53eb9859e614f7fe4c681213d33a 11-Aug-2015 Alex Deymo <deymo@chromium.org> update_engine: Remove all references to glib.

The message loop in production code switched from
chromeos::GlibMessageLoop to chromeos::BaseMessageLoop used in
chromeos::Dameon. This patch moves all the unittests also to use
chromeos::BaseMessageLoop or chromeos::FakeMessageLoop when I/O is not
required.

This patch removes all (now unused) references to glib.

BUG=chromium:499886
TEST=`grep glib[^c] . -R` return no results. Also, unittests work.

Change-Id: Iddfb17def501829d932ed1f70faad3e00268898e
Reviewed-on: https://chromium-review.googlesource.com/292157
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_attempter_unittest.cc
305345001d85ca2282112c2a30fe75c7a4773491 21-Jul-2015 Alex Deymo <deymo@chromium.org> update_engine: Switch to chrome-dbus for client requests in update_engine

update_engine daemon acts as DBus client to send DBus calls to shill,
power_manager and chrome, and to listen for signals from shill, chrome
and login_manager. This patch migrates these calls and signals to use
chrome-dbus framework instead of dbus-glib.

All references to dbus-glib code are removed.

BUG=chromium:419827
TEST=Updated unittest. Deployed on a link device and tested interactions with shill and chromium.

Change-Id: I31b389e0d1690cccb115ff3b6539c876ba81bd0e
Reviewed-on: https://chromium-review.googlesource.com/290990
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_attempter_unittest.cc
b7ca096f98a43ebbf412f1b2d3d15bb184f871f8 02-Oct-2014 Alex Deymo <deymo@chromium.org> update_engine: Migrate UE DBus service to chrome DBus bindings.

chromeos-dbus-bindings now generates the adaptor interface that
update_engine exposes over DBus. This interface is implemented in
dbus_service.{h,cc}, which now has a UpdateEngineService class
encapsulating all the service methods implementation.

This allows to write unit test for those methods, which are included
in this CL for all the non-trivial methods.

This CL now uses chrome's DBus bindings for the update_engine serive,
but the proxy interaction is still done using dbus-glib. The main loop
in the main.cc file is now replaced with the chromeos::Dameon, which
uses a chromeos::BaseMessageLoop instead of a GlibMessageLoop. This
causes the asynchronous interactions in the proxy side to not work,
which will be fixed in the next CL.

CQ-DEPEND=CL:290990,CL:291092,CL:293334
BUG=chromium:419827
TEST=Added unittest for all dbus_service methods. deployed and tested manually that update_engine dbus interface works.

Change-Id: I6a6d142b2ac1a61a4c3abcb927665b26114abe5c
Reviewed-on: https://chromium-review.googlesource.com/225324
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_attempter_unittest.cc
f6ee0163504eaf1a7cc136ba2c075d77ae2b4dd5 31-Jul-2015 Alex Deymo <deymo@chromium.org> update_engine: Move ConnectionManager to an abstract Interface.

MockConnectionManager required to use one of ConnectionManager
constructors passing pointers that won't be use by the mock. This
patch moves the interface to its own ConnectionManagerInterface class.

BUG=None
TEST=unittests still pass.

Change-Id: I9ed09daf8e4256304be7dab30cfbe751901dc24b
Reviewed-on: https://chromium-review.googlesource.com/290120
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_attempter_unittest.cc
461b259af8815d782200782c5ba3599d8de4a66c 25-Jul-2015 Alex Deymo <deymo@chromium.org> update_engine: Use libchromeos to launch subprocesses.

The Subprocess class handles the execution of suprocesses in the
update_engine such as the post-install script and bspatch operations.

This patch migrates this class from using glib functions to use
libchromeos classes with equivalent functionality.

Callsites and unittests were updated to match the new interface.

BUG=chromium:499886
TEST=Unittest still pass. Deployed on link and cros flash another image
using a delta payload.

Change-Id: Ia64d39734e220675113f393a6049e9a9b0fe8409
Reviewed-on: https://chromium-review.googlesource.com/288837
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_attempter_unittest.cc
60ca1a7bca7cc804ec80b510483081ef894de4cd 19-Jun-2015 Alex Deymo <deymo@chromium.org> update_engine: Migrate time-based glib main loop calls to MessageLoop.

This patch replaces most calls to g_idle_add* and g_timeout_add* with
the equivalent MessageLoop::Post*Task(). To maintain compatibility with
unittests running the main loop and doing I/O we instantiate a
GlibMessageLoop for those tests.

BUG=chromium:499886
TEST=unittests still pass.

Change-Id: Ic87ba69bc47391ac3c36d1bfc3ca28d069666af1
Reviewed-on: https://chromium-review.googlesource.com/281197
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Trybot-Ready: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_attempter_unittest.cc
eb9e6d8d8813b2d5a81a14e0184f7b4798573606 17-Apr-2015 Allie Wood <alliewood@chromium.org> update_engine: Remove copy from source to destination partition.

Removes the copy of the old rootfs and kernel to the new rootfs and
kernel. This was initially done in FilesystemCopierAction, which is now
called FilesystemVerifierAction.

When FilesystemVerifierAction is given a source rootfs or kernel, it
calculates the hashes. When asked to verify the new rootfs or kernel, it
computes the hashes and compares them against the values in the manifest.

BUG=chromium:463562
TEST=Updates using `cros flash --src-image-to-delta` and unit tests.
CQ-DEPEND=CL:267360

Change-Id: I3c9ba60fa4af0c5381ba8a10883bd47dc40adb8c
Reviewed-on: https://chromium-review.googlesource.com/267554
Reviewed-by: Allie Wood <alliewood@chromium.org>
Commit-Queue: Allie Wood <alliewood@chromium.org>
Trybot-Ready: Allie Wood <alliewood@chromium.org>
Tested-by: Allie Wood <alliewood@chromium.org>
/system/update_engine/update_attempter_unittest.cc
02c1864e204997175302b1aebe3e0be9c6699ea5 06-Nov-2014 David Pursell <dpursell@chromium.org> update_engine: Allow `cros flash` on base images.

A goal of the upcoming debugd dev tools (crbug.com/403170), is to
enable a path to modify a base image such that a developer could run
`cros flash` on it.

Currently update_engine disallows custom omaha URLs and forces a hash
check for base builds, which breaks `cros flash`. This CL relaxes the
restriction slightly to allow use on a base build as long as the system
is in dev mode and the debugd dev tools are also enabled (dev tools are
currently enabled only in dev mode when there is no owner).

The check is done in update_attempter.cc, which only allows an unofficial
Omaha URL if these conditions hold true (unofficial meaning not the main
AU server or the AU test server). The other main change is
AreHashChecksMandatory() in omaha_response_handler_action.cc, which now
allows skipping hash checks for unofficial Omaha URLs.

BUG=chromium:428053
TEST=Ran unit tests, `cros flash` on base images in various states.
CQ-DEPEND=CL:227431

Change-Id: I8583ce6aa70feac8fe74b7a3992e8a4e761833c3
Reviewed-on: https://chromium-review.googlesource.com/228293
Reviewed-by: Alex Deymo <deymo@chromium.org>
Trybot-Ready: David Pursell <dpursell@chromium.org>
Commit-Queue: David Pursell <dpursell@chromium.org>
Tested-by: David Pursell <dpursell@chromium.org>
/system/update_engine/update_attempter_unittest.cc
610277efc6f7e5239158dfa4bb3b1021804326e0 12-Nov-2014 Alex Deymo <deymo@chromium.org> update_engine: Add override when possible.

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>
/system/update_engine/update_attempter_unittest.cc
10875d90cf67f883ba7c9ed13bc8d706aa8c6fbc 11-Nov-2014 Alex Deymo <deymo@chromium.org> update_engine: Move test-only utils to test_utils.{h,cc}.

utils.{h,cc} contains a collections of basic or small functions used
in different parts of the codebase. The test_utils.{h,cc} instead
contains functions only required during testing split out to a
separated file to be reused in different tests.

This CL moves without changes some functions defined in utils.h that
were only used during unittests. Two other basic functions were replaced
by the same function already present in base/ (StringHasSuffix and
StringHasPrefix). The functions in test_utils.h now have their own
namespace chromeos_update_engine::test_utils so is clear they come
from the test_utils file, in the same way the ones from utils are
in their own namespace.

Some othe minor linter fixes included here.

BUG=chromium:351429
TEST=Unittest still pass.

Change-Id: I73ab72a14158cb21c8e1f404cbc728423bc8f34f
Reviewed-on: https://chromium-review.googlesource.com/229021
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_attempter_unittest.cc
8427b4a6d0e6e02beedbb53798272f8ddc39386f 05-Nov-2014 Alex Deymo <deymo@chromium.org> update_engine: Standarize mock/fake filenames.

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>
/system/update_engine/update_attempter_unittest.cc
2c0db7b68d1f1fa4538b0c34e2fb5c58930ae0c8 04-Nov-2014 Alex Deymo <deymo@chromium.org> update_engine: Use FakePrefs instead of the real Prefs in unittests.

Several unittests were using the real Prefs class on a temporary
directory that was removed at the end of the test. On
UpdateAttempterTest.DecrementUpdateCheckCountTest this directory was
leaked due to the use of the ScopedDirRemover which only works on
empty dirs, used elsewhere to remove mount points.

This patch replaces all the uses of a real Prefs class initialized
on a temp directory with a FakePrefs instance, which provides the
same functionality and simplifies the initialization.

p2p_manager_unittest.cc is left out of this patch since its usage of
Prefs is being removed in a different CL.

BUG=chromium:356906
TEST=All unittests still pass.

Change-Id: Ieba6b924fcbda9e1787becba334792aabe0f395a
Reviewed-on: https://chromium-review.googlesource.com/227444
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_attempter_unittest.cc
74b5f55e6ff608857664fe151f54d78bfe0b75bb 07-Oct-2014 Gilad Arnold <garnold@chromium.org> update_engine: Relocate inference and storage of P2P related properties.

This change moves the inference of P2P related properties from
OmahaRequestAction to OmahaResponseHandlerAction, and their storage from
OmahaRequestParams to PayloadState. This is needed in order for the
UpdateCanStart policy to be able to decide P2P properties, which only
happens after the Omaha response is received and processed, and prior to
applying the update. Further, P2P properties do not affect the Omaha
request, and so there's no reason for them to reside in
OmahaRequestParams nor decided as early as OmahaRequestAction.

Additional cleanup includes swapping expected/actual arguments to EXPECT
macros where appropriate, and removing redundant .Times(1) expectation
qualifiers.

BUG=chromium:384087
TEST=Unit tests.

Change-Id: I6d5b4b44745d5dab7e350bdf019dbf804bf196a1
Reviewed-on: https://chromium-review.googlesource.com/223618
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_attempter_unittest.cc
f329b933db41d26644a97afef928eb1b319d6d99 30-Oct-2014 Alex Deymo <deymo@chromium.org> update_engine: Fix all the "using" declaration usage.

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>
/system/update_engine/update_attempter_unittest.cc
749ecf1c000ce0243c2eee986282dd568535bafe 22-Oct-2014 Alex Deymo <deymo@chromium.org> update_engine: Re-introduce RefreshDevicePolicy() before computing update params.

The update_manager refreshes the policy for its own usage, but the
code that still remains outside the update_manager and depends on
device policy settings has to reload the policy manually.

This patch re-introduces the call to RefreshDevicePolicy() from
CalculateUpdateParams() that was removed in CL:209101 since some
code still requires it.

BUG=chromium:425827
TEST=delopyed this patch on R39 and tested that the scattering value from the policy is used.
TEST=Changed UpdateAttempterTest.UpdateTest to check this. Verified it fails without the change on update_attempter.cc

Change-Id: I051382987b507752e52a0af87d869a8845f3db6f
Reviewed-on: https://chromium-review.googlesource.com/224808
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Gaurav Shah <gauravsh@chromium.org>
/system/update_engine/update_attempter_unittest.cc
02f7c1dee242f490143791dbb73fa23fa3007cfa 19-Oct-2014 Ben Chan <benchan@chromium.org> update_engine: Replace scoped_ptr with std::unique_ptr.

BUG=None
TEST=`FEATURES=test emerge-$BOARD update_engine`
TEST=`USE='clang asan' FEATURES=test emerge-$BOARD update_engine`

Change-Id: I55a2f7f53675faaac20ba25f72ed52cf938d7744
Reviewed-on: https://chromium-review.googlesource.com/224189
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/update_engine/update_attempter_unittest.cc
06c76a49bfd29c8abdb8abd5b646a6583783191a 05-Sep-2014 Ben Chan <benchan@chromium.org> Update code to include base/files/file_util.h

file_util.h was moved from base to base/files
(https://codereview.chromium.org/468253002). This CL updates platform2
code to include base/files/file_util.h instead of base/file_util.h.

BUG=chromium:411001
TEST=Trybot run on paladin, release, and chromiumos-sdk builders.

Change-Id: I488925b54615e131e508a460dc1a27f88168f936
Reviewed-on: https://chromium-review.googlesource.com/216851
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/update_engine/update_attempter_unittest.cc
ec7f91625b799abf67ea3119490f2f1de8e4e677 15-Jul-2014 Gilad Arnold <garnold@chromium.org> update_engine: Ditch UpdateCheckScheduler, use UpdateCheckAllowed instead.

This change removes the update_check_scheduler module and replaces it
with async requests to the UpdateCheckAllowed policy, done by the
UpdateAttempter directly.

* A new UpdateAttempter::ScheduleUpdates() is used as a replacement for
UpdateCheckScheduler::Run() and rescheduling of periodic checks inside
UpdateCheckScheduler. The callback
UpdateAttempter::OnUpdateScheduled() handles both periodic and
interactive checks.

* The UpdateAttempter keeps track of whether or not an update check is
being waited for (waiting_for_scheduled_check_) so that we can ensure
liveness. This is a similar check to the one performed inside the
UpdateCheckScheduler.

* Inference of the update target version prefix and channel (via device
policy), as well as update disabled, are now performed by the
UpdateManager policy. Also eliminating reference to the list of
network types allowed by policy, which is not enforced anyway and will
be superceded by another policy request (UpdateDownloadAllowed).

* Since update check scheduling is now performed relative to the last
update check time (as recorded by the UpdateAttempter), we care to
update this time as soon as the request is issued (in addition to when
a response is received). This ensures that we won't be scheduling
back-to-back update requests in the case where a response was not
received. Updating the last check time is delegated to a method call;
we replace raw use of time(2) with the ClockInterface abstraction.

* Handling of forced update checks has been revised: the UpdateAttempter
keeps track of the most recent app_version and omaha_url values that
were received through DBus events; it notifies the UpdateManager not
only of whether or not a forced (formerly, "interactive") update
request is pending, but also whether or not it is indeed interactive
or should be treated as a normal periodic one. The UpdateManager
reflects this back to the updater via the result output of
UpdateCheckAllowed, which tells the UpdateManager whether the custom
app_version and omaha_url should be used (interactive) or not.

BUG=chromium:358269
TEST=Unit tests.

Change-Id: Ifa9857b98e58fdd974f91a0fec674fa4472e3a9d
Reviewed-on: https://chromium-review.googlesource.com/209101
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_attempter_unittest.cc
88b591f24cb3f94f982d7024c2e8ed25c2cc26a2 29-Aug-2014 Alex Vakulenko <avakulenko@chromium.org> update_engine: Replace NULL with nullptr

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>
/system/update_engine/update_attempter_unittest.cc
3e0b53e2c4aaecebc7c0c60b48f41ce27c7eaa55 13-Aug-2014 Alex Deymo <deymo@chromium.org> update_engine: Fake chromeos-setgoodkernel command for testing.

This patch fakes the chromeos-setgoodkernel command when running
unittests so the command doesn't attempt to run it. It also makes
Subprocess log the error message when there's a failure running
an async process.

BUG=chromium:401866
TEST=cros_workon_make update_engine --test

Change-Id: Ieca3216c57f6f9bc2f71a53e520575ae1fc19c0e
Reviewed-on: https://chromium-review.googlesource.com/212260
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_attempter_unittest.cc
9abb763fa3840d69cc1098c0233162557a7f99ea 07-Aug-2014 Ben Chan <benchan@chromium.org> update_engine: Use integer types from stdint.h

This CL replaces the deprecated int* and uint* types from
'base/basictypes.h' with the int*_t and uint*_t types from 'stdint.h'.

BUG=chromium:401356
TEST=`FEATURES=test emerge-$BOARD update_engine`

Change-Id: I658b34ad9e6feb938e0b569b72947a052ef8f8af
Reviewed-on: https://chromium-review.googlesource.com/211380
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/update_engine/update_attempter_unittest.cc
d2779df63aaad8b65fc5d4badee7dbc9bed7f2b6 16-Jun-2014 Alex Vakulenko <avakulenko@chromium.org> update_engine: fixed warnings from cpplint

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>
/system/update_engine/update_attempter_unittest.cc
d1c4d2dd3daed1d507038046c0355fbafb85260c 05-Jun-2014 Gilad Arnold <garnold@chromium.org> Change ErrorCode into an enum class.

This change is needed in order for us to be able to import ErrorCode
symbols from chromeos_update_engine into chromeos_update_manager.
Unfortunately, shifting from plain 'enum' into an 'enum class' means
that the compiler treats the new class as a distinct type from int,
which in turn means that plenty of seamless arithmetic/bitwise
operations we used for manipulating error code values throughout the
code needed to be retrofitted with static_cast operators.

In the future, we should consider imposing a proper abstraction on
update engine error codes that'll prevent mingling with value encoding
directly and prevent such nastiness. It'll also make things more
coherent (types, semantics) and safer.

BUG=chromium:358329
TEST=Unit tests.

Change-Id: Ie55fa566b764cdab6c4785d995fb6daee4cb32d3
Reviewed-on: https://chromium-review.googlesource.com/203209
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_attempter_unittest.cc
736fcb57ca2dcf09710a797e4c23a64f6cd64e16 22-May-2014 Ben Chan <benchan@chromium.org> update_engine: Update to build against libchrome-271506.

BUG=chromium:375032
TEST=`FEATURES=test emerge-$BOARD update_engine`

Change-Id: Ia7be302c12b439ad8aece51c9cbe128086626620
Reviewed-on: https://chromium-review.googlesource.com/201045
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Ben Chan <benchan@chromium.org>
/system/update_engine/update_attempter_unittest.cc
7d623ebf9eee346fdeee71f1ccb32ebaf4bd3318 14-May-2014 Nam T. Nguyen <namnguyen@chromium.org> update_engine: Remove GPIO support.

We have not used GPIO since Jan 2013. This CL removes the GPIO handling code.
As a side effect, it also removes dependency on libudev.

BUG=chromium:221725
CQ-DEPEND=CL:199683
TEST=unittest
TEST=AU end2end test on real device from older version to a version that
has CL applied, then from that to another newer version (need not have
this CL applied).

Change-Id: I4352488ec360b44a44b137c40a3ae4ec35c6fe9d
Reviewed-on: https://chromium-review.googlesource.com/199626
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Nam Nguyen <namnguyen@chromium.org>
Tested-by: Nam Nguyen <namnguyen@chromium.org>
/system/update_engine/update_attempter_unittest.cc
5bb4c90b8bdf931426d1926b21b0316a86b4b4e4 10-Apr-2014 Gilad Arnold <garnold@chromium.org> Rename MockSystemState into FakeSystemState.

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>
/system/update_engine/update_attempter_unittest.cc
1f84723f499b3b309efac11324ed4e6c937341b6 07-Apr-2014 Gilad Arnold <garnold@chromium.org> Revise the SystemState hierarchy.

* Removed all #includes from SystemState; added includes in .cc files
that use the various objects (MetricsLibrary, DevicePolicy, etc).

* MockSystemState:

- Regulated the set of getters/setters: foo() returns the current Foo
object interface; this object can be overridden by set_foo();
mock_foo() or fake_foo() returns the default (internal) mock/fake
equivalent, and fails if it is different from foo() (safety).

- Make member declaration order consistent with that of API.

- Removed MOCK_METHOD declarations for two methods and replaced them
with fake getter/setter. This means that MockSystemState is now
reduced to a fake, and can be renamed (separate CL). This also means
that a few tests have a slightly different semantics now.

* All virtual overrides are qualified as such. However, removed the
'const' method qualified from all getters: it made little sense,
especially when considering that getters are handing addresses of
internal mock members.

* Made the UpdateAttempter a contained member of both
{Real,Mock}SystemState, resolving initialization dependencies. In
general, the invariant is that all members of the SystemState that
rely on it being fully populated by the time of their initialization,
need to export a separate Init() method, that will be called (by the
SystemState implementation constructor or Init() method) only after
all members are set.

* Made the mock GPIO handler and connection manager contained members of
MockSystemState; the destructor could safely be moved.

* Cleanup in UpdateAttempter (part of resolving dependencies):

- Ordinary member initialization done via default initializers
(constants) or initializer list in the constructor (parameters).

- Init() method only does work that cannot be done during
construction, with appropriate comment documenting the need for it.

- Better reuse via constructor delegation.

BUG=chromium:358278
TEST=Unit tests.

Change-Id: I96ff6fc7e7400b0a9feb6cc8d4ffe97a51000f91
Reviewed-on: https://chromium-review.googlesource.com/193587
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/update_attempter_unittest.cc
bccbc387ed23ec18adcd0ef8b50d958ef38cd619 03-Apr-2014 Alex Deymo <deymo@chromium.org> Move IsOOBEComplete to HardwareInterface.

This patch moves the mockable IsOOBEComplete to the HardwareInterface
which already has a fake implemented. This is required as a first
step to make it available on the PolicyManager.

This patch also passes a null pointer when the timestamp isn't
required.

BUG=chromium:358269
TEST=Unittests adjusted and passing.

Change-Id: I620e0f4521832b3f2c0170811116251cdfe58f26
Reviewed-on: https://chromium-review.googlesource.com/193101
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_attempter_unittest.cc
44b9b7ed0a702e54afccb86228668c59151859be 02-Apr-2014 Chris Sosa <sosa@chromium.org> Fix rollback crash while previous rollback is in progress.

The CHECK in Rollback is wrong. We should not be crashing the update_engine
just because we have a previous rollback in progress. This CL changes the
CHECK to a if/else and cleans up the Rollback() logic to be easier to follow
and removes a redundant check for partitions (since CanRollback already
covers this problem).

This CL also cleans up a couple rollback-related unittests.

BUG=chromium:356975
TEST=unittests + on device

Change-Id: Iee8de65eabcddd1dbe6c6413e33a15bf75302260
Reviewed-on: https://chromium-review.googlesource.com/192909
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
/system/update_engine/update_attempter_unittest.cc
75039d7397f03dff77bdf4e26398049ff88edc4c 25-Mar-2014 Alex Vakulenko <avakulenko@chromium.org> update_engine: update to libbase 242728

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>
/system/update_engine/update_attempter_unittest.cc
d38b113179e6d238ad7db16629b1146222c57c85 25-Mar-2014 Chris Sosa <sosa@chromium.org> Remove stable channel check for rollback.

BUG=chromium:356265
TEST=Unittests

Change-Id: Id1b8345fdf5cbd4ea12e3fe297b41260b96ee86c
Reviewed-on: https://chromium-review.googlesource.com/191443
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
/system/update_engine/update_attempter_unittest.cc
1b9d6ae00b3c3badf9785584c2c867710f214a62 03-Mar-2014 Gilad Arnold <garnold@chromium.org> Further cleanup around DBus interface classes.

* Removed the "Glib" part from the various DbusGlib class name and added
"Wrapper" instead: only part of the methods here declared have
anything to do with Glib; in essence, this is an interface containing
wrappers for various DBus functions.

* Changed "Dbus" to "DBus", to comply with the rest of the world.

* Renamed the actual implementation "RealDBusWrapper" (instead of
"Concrete").

* Separated out RealDBusWrapper into its own header file. Client code,
which often only cares about the abstract class, does not need to pull
it unless specifically requiring it.

* Cleaned up the includes in these headers.

Aside from all that, also renamed system_state.cc into
real_system_state.cc, as this is what this file contains.

BUG=None
TEST=Unit tests.

Change-Id: I015c407cbc159aba8b5925eb0e916ba604c829cd
Reviewed-on: https://chromium-review.googlesource.com/189373
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_attempter_unittest.cc
639aa36fc7e27ba400402cd7a32b091f555783a6 04-Feb-2014 David Zeuthen <zeuthen@chromium.org> Record installation date and include it in every Omaha request.

Introduce a new state variable, install-date-days, to track the the
point in time that OOBE completed and include this value - if set - in
each Omaha request. This state variable tracks the number of PST8PDT
("Pacific Time") calendar weeks since Jan 1st 2007 0:00 PST, times
seven. It is included as an attribute of the <app> element, like this:

<app appid="{...}" ... delta_okay="true" ... installdate="2590">

If the state variable is not set, the installdate attribute is not
included.

For new installs (e.g. where OOBE is not complete), the
install-date-days variable is set from the "elapsed_days" value in the
Omaha response. In this case - which should be the majority going
forward - we don't rely on the local clock on the device at all.

On the other hand, for existing installs (e.g. where OOBE was
completed in an OS version not including this CL) and also new
installs where the update-check during OOBE failed (e.g. no network
connection), install-date-days is derived from the timestamp of the
/home/chronos/.oobe_completed marker file. This case obviously relies
on the local clock on the device being set correctly.

Also introduce a new metric, Installer.InstallDateProvisioningSource
to track how install-date-days is provisioned. This metric has two
possible values, kProvisionedFromOmahaResponse (0) and
kProvisionedFromOOBEMarker (1).

In addition to new unit tests, I tested this manually by munging the
/home/chronos/.oobe_completed and
/var/lib/update_engine/prefs/install-date-days files. Also, since
devserver does not send the "elapsed_days" value, I had to point
update_engine to the official Omaha server using the -omaha-url option
with the https://tools.google.com/service/update2 value.

BUG=chromium:336838
TEST=New unit tests + unit tests pass + manual testing.

Change-Id: Id901059c4ab0f9184d1f4ddce72273d739e58224
Reviewed-on: https://chromium-review.googlesource.com/184907
Tested-by: David Zeuthen <zeuthen@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/update_attempter_unittest.cc
a6742b35938b6f58e24e3f1c550fe92d4d33eb74 11-Jan-2014 Gilad Arnold <garnold@chromium.org> AU: shift to use new TMPDIR-enabled temp file

The main change here is that delta generator will now create all
temporary files in TMPDIR, if set. Other than that, we're converting all
other temporary file/directory creation to use the new functions.

- All temps of the form "/tmp/foo" are converted to "foo": this
preserves the behavior in the default case (where TMPDIR is not set),
yet will do the right thing if run with a different TMPDIR.

- A few other cases (for example, temp file created relative to the
current working directory) will now be created in TMPDIR or /tmp.
These are all in unit tests and the transition makes sense anyway.

Note that two temp file/directory creation calls in actual UE code were
using "/tmp/..." and were not changed. This will ensure that they are
resilient to TMPDIR changes and will always be allocated in the same
(hard-coded) location.

BUG=chromium:253622
TEST=Unit tests.

Change-Id: Ia1208963a0e2fcd43b8d6f92bb3d1b7459e930a2
Reviewed-on: https://chromium-review.googlesource.com/182247
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_attempter_unittest.cc
6646b44ac128d07b33435d0bbf7cfd140af15eb9 14-Nov-2013 Don Garrett <dgarrett@google.com> Don't rollback if the other partition isn't valid.

Before we start a rollback to the other OS slot, validate the GPT flags show
it as bootable. This should prevent us from attempting a rollback if an
update has been attempted and failed, or is currently in progress. Such
a rollback would always fail, since the other partition would be left in
a partially modified state.

Piggyback:
Move sanity test in hardware that was added to the wrong method.
Undid some unittest changes that were decided against after the fact.

BUG=chromium:267054
TEST=Unittests
Manual Update Rollbacks (with/without flags on other partition)

Change-Id: Ide6b0673855ba2e4b05a0db93413a1a9f2ece2a9
Reviewed-on: https://chromium-review.googlesource.com/176755
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
/system/update_engine/update_attempter_unittest.cc
3c55abd5fa1e3db40974b2e8d94f2ddce65fe40d 14-Oct-2013 David Zeuthen <zeuthen@chromium.org> Add D-Bus method to get the duration since an update completed.

This new API can be used by Chrome to automatically reboot the device
at N hours after updating. This is implemented as a D-Bus method that
returns the number of micro-seconds on the wall-clock since the update
completed. If the device has not updated, the D-Bus method returns an
error.

For robustness, durations are measured using the CLOCK_BOOTTIME clock
instead of the usual CLOCK_REALTIME clock. This avoids interference
with NTP adjustments, the RTC clock being wrong and other things.

BUG=chromium:218192
TEST=New unit test + unit tests pass + manual test on a device using
the gdbus(1) command as the chronos user.

Change-Id: I51d44d69afe2d3024bb0780916c3c4e3f8ebb19e
Reviewed-on: https://chromium-review.googlesource.com/173032
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/update_attempter_unittest.cc
c1f07c34c0907a8b281407fbf42d2aa61d65b045 10-Oct-2013 Daniel Erat <derat@chromium.org> update_engine: Use shared constants for update status.

BUG=chromium:221803
TEST=did a build
CQ-DEPEND=I8558357a20a54e6d9df237bba03ebfc2b6a00f08

Change-Id: I391c952c409b1721254d2d4a35f9ebca5d39bc0e
Reviewed-on: https://chromium-review.googlesource.com/172615
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Daniel Erat <derat@chromium.org>
Commit-Queue: Daniel Erat <derat@chromium.org>
/system/update_engine/update_attempter_unittest.cc
985b112a749ccbe025ea4aa0245b13f92c28a057 09-Oct-2013 David Zeuthen <zeuthen@chromium.org> Add Installer.OSAgeDays metric

This adds a new metric conveying the age of the running OS instance,
where this is defined as the time-span between the current wall-clock
time and the time-stamp of the /etc/lsb-release file. This metric is
reported daily.

BUG=chromium:304950
TEST=New unit tests for daily metrics + unit tests pass. Manual test
for Installer.OSAgeDays by inspecting chrome://histograms.

Change-Id: I6713bed6730641a95443372a3e3166c4e1dc64ee
Reviewed-on: https://chromium-review.googlesource.com/172162
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/update_attempter_unittest.cc
8f191b22a1a1ab2b803d65ee488729206e648695 06-Aug-2013 David Zeuthen <zeuthen@chromium.org> p2p: Use p2p for updates

This is the main patch for enabling use of p2p for consuming and/or
sharing updates via p2p. Refer to the ddoc and other documentation for
how this works.

BUG=chromium:260426,chromium:273110
TEST=New unit tests + unit tests pass + manual testing
Change-Id: I6bc3bddae1e041ccc176969a651396e8e89cb3f0
Reviewed-on: https://chromium-review.googlesource.com/64829
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/update_attempter_unittest.cc
70e476ed0a09f8ca2d0a9e3f0e1cd78ccefd5fbe 31-Jul-2013 Gilad Arnold <garnold@chromium.org> AU/unittest: allow use of a parametric update completed marker

This should allow unit tests to be run in parallel. We introduce
a private constructor available only to specific test classes of
UpdateAttempter, which allows us to set a different marker.

Note that, in all unit tests that do not specifically make use of this
marker, we actually want UpdateAttempter to ignore it entirely. I'm not
entirely positive whether not ignoring would lead to interferences
between concurrently run tests, but I think it's better to err on the
safe side. (The marker is never ignored when used with any code other
than UpdateAttempter unit testing code.)

BUG=chromium:236465
TEST=Unit tests pass incl ignore semantics when not needed

Change-Id: I30fbed2ae2c21368d79127ed44811007e2a66e77
Reviewed-on: https://gerrit.chromium.org/gerrit/63840
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_attempter_unittest.cc
eff87cc42e9d3777a6dcf01bddcdfec152674ace 23-Jul-2013 Gilad Arnold <garnold@chromium.org> AU/unittest: eliminate use of fixed named test directories

This fixes race conditions when tests are run in parallel.

Note that integration_unittest.cc is currently not (never was?) being
compiled, so all changes are lexically oriented and visually verified
only.

BUG=chromium:236465
TEST=Tests successful

Change-Id: I6181a2cc0c10f6fcf8f982fc263c7a02e5082eeb
Reviewed-on: https://gerrit.chromium.org/gerrit/62954
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_attempter_unittest.cc
4243291a6655972fe89d4747a0089834c9e47c20 13-Jul-2013 Alex Deymo <deymo@chromium.org> Send an UMA metric when failed to boot into the new partition.

When a payload is successfully applied, the /other/ partition
is marked as valid and a reboot is needed, the reboot into this
new partition can fail due to several reasons. If than happens,
the firmware can rollback to the previous partition.

When this happens, this fix sends a new UMA metric with the
attempt number of this failing payload.

In order to test this functionality we need to fake the
utils::BootDevice() to emulate a reboot into the same or
a different partition. To achieve this, this function is
moved to a new "HardwareInterface" that can be faked
using the FakeHardware class that can hold similar hardware
related functions. Implementations and unittest were
refactored as needed.

BUG=chromium:243572
TEST=unittests

Change-Id: I1a4242df0bd61e2718ab881ead603b1d3705b877
Reviewed-on: https://gerrit.chromium.org/gerrit/61815
Commit-Queue: Alex Deymo <deymo@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/update_attempter_unittest.cc
28e479c3b08cb4d1280905f5d3510f8ec4ed719c 12-Jul-2013 Chris Sosa <sosa@chromium.org> Don't allow rollback on the stable-channel.

This change explicitly disallows rollback on the stable-channel.

BUG=chromium:252539
TEST=unittests + on device.

Change-Id: I71caf95daae185790cf9fb0fda790eaf960bbe6b
Reviewed-on: https://gerrit.chromium.org/gerrit/61687
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
/system/update_engine/update_attempter_unittest.cc
76a29aef71c1602d6dcec6fc7062d2162b03c9ec 12-Jul-2013 Chris Sosa <sosa@chromium.org> Don't allow rollback when we are enterprise enrolled.

As stated (and verified) by the device_policy protobuf, we can determine
whether a device is enterprise enrolled by checking if GetOwner is empty.
We use this knowledge to not allow rollback when powerwash is also requested (
the default).

As part of this CL I've figured out how to unittest Rollback and added tests
for both enterprise and non-enterprise rollback.

BUG=chromium:254829
TEST=Tested on both an enrolled and non-enrolled device. Verified only the
latter actually did a powerwash while the other aborted correctly. Also ran
new unittests

Change-Id: Idfe6bfef88819fe1bab7da6b31854faf7642c9ce
Reviewed-on: https://gerrit.chromium.org/gerrit/61645
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
/system/update_engine/update_attempter_unittest.cc
53173b964f6f43c89dbaba41875fcadd7077b2ea 18-May-2013 Jay Srinivasan <jaysri@chromium.org> Download via HTTP only if enterprise policy allows.

In order to rollout HTTP-downloads for AU to stable channel, we want to
be a bit more conservative to preseve the defense in depth we have now
with HTTPS. So, we're introduced a new enterprise policy which should be
explicitly enabled in order for the payloads to be downloaded via HTTP.

This CL adds the support for honoring such a policy in update engine.

BUG=chromium:235562
TEST=New unit tests added, existing ones updated and they all pass.
TEST=Tested on ZGB with and without policy and it works as expected.
Change-Id: I356efbe237b10031161a57c70cb851c521915a76
Reviewed-on: https://gerrit.chromium.org/gerrit/55805
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/update_attempter_unittest.cc
a99981fda75fe0b17e96c700e3ddc93eca1cebe5 29-Apr-2013 David Zeuthen <zeuthen@chromium.org> Rename ActionExitCode to ErrorCode

Nowadays ActionExitCode is used throughout the codebase so use a more
generic name to reflect this.

BUG=chromium:216507
TEST=unit tests pass

Change-Id: I23d1d7e2676443251dbc42ed137fd018aadfa8a3
Reviewed-on: https://gerrit.chromium.org/gerrit/49512
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/update_attempter_unittest.cc
ae4697c073b84b260990a141acd53c6806da0708 19-Mar-2013 Jay Srinivasan <jaysri@chromium.org> Enhanced channel changing behavior

This CL adds a new DBUS API to UpdateEngine called SetTargetChannel to
change the current channel of the device with an option to indicate
whether to do eventually or immediately.

The API will be called with the option to do it immediately in a
subsequent CL in Chrome UI. For now the old API (set_track) has been
wired up to call the new API to produce the old behavior (i.e. change
eventually). The old API will be removed after Chrome UI code stops
using it.

It's the UI's responsibility to ask the user for confirmation for the
powerwash that may happen in some cases and call the API with the
appropriate value whether or not the powerwash should happen.

For now, we're restricting the changing of channels to only those
devices that are on canary-channel or running test builds. This
restriction will be lifted off once the UI work is ready to give
warning to the users about the powerwash that may happen when they move
to a more stable channel.

We also enforce ReleaseChannelDelegated and ReleaseChannel policies
correctly now as follows:

* If ReleaseChannelDelegated is false, SetTargetChannel will fail as we
need to honor (only) the ReleaseChannel value in this case.
* If ReleaseChannelDelegated is true, we'll allow the SetTargetChannel
call to specify. In this case, we'll ignore the value of ReleaseChannel,
if any.

BUG=chromium-os:39095
TEST=Tested on ZGB by going from canary to dev-channel with and without
powerwash.
TEST=Existing unit tests have been updated and they pass.
TEST=New unit tests have been added.

Change-Id: Ifbf806a06e1c30d2f318e94d73735d1812049abd
Reviewed-on: https://gerrit.chromium.org/gerrit/44619
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/update_attempter_unittest.cc
b92f0df60b3b1d8ad0ac95fea74cc4fbbf93d204 11-Jan-2013 Gilad Arnold <garnold@chromium.org> AU: coalesce interactive / user-initiated flags

The latter was introduced recently but turns out it just carries
a duplicate meaning to the former, so we're eliminating it. This also
makes the case of a simulated scheduled update check more accurate, as
all of the effects of a scheduled update are made.

BUG=None
TEST=Unit tests; interactive/scheduled update check behaves as expected.

Change-Id: I8971aefcfc15cb76733059860832507e88795883
Reviewed-on: https://gerrit.chromium.org/gerrit/41082
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_attempter_unittest.cc
55f50c24c2624487b803ba2f93588494cc69e523 11-Jan-2013 Jay Srinivasan <jaysri@chromium.org> Segregate UMA metrics for production scenarios from test scenarios.

Currently we separate the UMA metrics only by one category: whether the
device is in dev mode or not. In addition, we need to exclude the noise
from these two categories:
1. Most of our testing on MP-signed images which are performed
with autest.
2. All our hwlab tests run in non-dev mode but they use dev-signed images
with dev-firmware keys.

So this CL defines additional bit fields to represent these states and
if any of these three flags are set, the UMA metric is sent to a
DevModeErrorCodes bucket. Thus the NormalErrorCodes bucket will have only
the production errors and thus we can monitor more effectively.

BUG=chromium-os:37613
TEST=Updated unit tests, ran on ZGB for all scenarios.
Change-Id: Id9cce33f09d1cc50cb15e67c731f7548940cbc24
Reviewed-on: https://gerrit.chromium.org/gerrit/41103
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/update_attempter_unittest.cc
bf7919ba5ecd58a6a03afdca8ff88caebd25581d 08-Jan-2013 Gilad Arnold <garnold@chromium.org> AU: disable GPIOs in production; some structural changes

Since we are not making use of the GPIO funcionality in UE for the
moment, it's been advised that it should be disabled. This CL does just
that, plus a few small changes:

* Adds a "no-op" GPIO implementation, which simply returns a constant
value every time it's being asked whether test-mode was signaled (in
this case, we set it to return false).

* The GPIO handler is embedded in SystemState. This makes sense from
both the conceptual and usability standpoint. The SystemState object
can be parametrized to initialize either a real or a no-op GPIO
handler.

BUG=chromium-os:32263
TEST=passes unit tests; does not engage GPIO protocol on x86-alex

Change-Id: I8121647baa7611041073dcf305beddab57c0e49c
Reviewed-on: https://gerrit.chromium.org/gerrit/40633
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_attempter_unittest.cc
2b5a0f065187fd19179e3809148dbfc376ada7a0 20-Dec-2012 Jay Srinivasan <jaysri@chromium.org> Classify errors and advance URL index according to the error code.

In CL https://gerrit.chromium.org/gerrit/39638, we always incremented
the URL index irrespective of the error code. That would cause the first
URL to be given up too quickly in favor of the second one even for
transient errors such as when user closes a lid and reopens after some
time.

The right behavior in this case is to just count those failures towards
the URL and only after repeated failures with no progress should we
advance the URL index.

This CL implements this logic and completes the multiple URL-related
work items outlined in the design doc.

BUG=chromium-os:37206
TEST=Tested all uses cases on my ZGB. Added and updated unit tests.

Change-Id: Ida0cfbfeb9bfab732144049d1b27e3b8958bc252
Reviewed-on: https://gerrit.chromium.org/gerrit/39885
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/update_attempter_unittest.cc
6f6ea00aa8c4cf54b6842be32ca1226854c24f78 14-Dec-2012 Jay Srinivasan <jaysri@chromium.org> Support for processing multiple URLs in update_engine.

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>
/system/update_engine/update_attempter_unittest.cc
4f8ee27b3592351cd71897d192065758340932d1 30-Nov-2012 Chris Sosa <sosa@chromium.org> Modify priority tweaking to use CGroups.

This modifies the behavior of setpriority and getpriority
to use CGroups rather than niceness levels.

I've removed the unittest comparing priorities as its not
really valid any more as we are just writing numbers to files.

I've also refactored references to priority to reference cpu
shares etc.

BUG=chromium-os:36229
TEST=Unittest + doing end to end test in bgnd
CQ-DEPEND=I6a0e56073e7281268e0550919c9ec9202b18db26

Change-Id: I48c8270c2065f1e0677e5e53df3557131577b97c
Reviewed-on: https://gerrit.chromium.org/gerrit/39147
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Ready: Chris Sosa <sosa@chromium.org>
/system/update_engine/update_attempter_unittest.cc
f057205065339c54d3403263f049e2ea69417665 24-Oct-2012 Jay Srinivasan <jaysri@chromium.org> Send UMA Stats for update engine error codes.

With the latest addition of new optional security checks for the update
manifest and operations checked in, we now want to track the number of
failures, if any, over time to help us decide when it is safe to make
the new security checks mandatory. This CL adds the UMA metric for
reporting the new (as well as the old) error codes to UMA for the first
time.

There's no change to the existing errors that are being sent to Omaha.
Due to UMA restrictions, some Omaha codes will be aggregated when being
sent to UMA.

BUG=chromium-os:34299
TEST=Unit tests pass, tested on real ZGB, all stats show up in
chrome://histograms correctly for both dev mode and normal mode.
Change-Id: I3ce4645636311cedbb33f601e775951966c0a545
Reviewed-on: https://gerrit.chromium.org/gerrit/36408
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/update_attempter_unittest.cc
51dcf260754837962dd22db3b7babee181471e7d 14-Sep-2012 Jay Srinivasan <jaysri@chromium.org> Verify AU payload manifest signature if present.

In order to support downloads over http for a number of reasons, we need
to secure http downloads. The first step in this process is to
verify the signature of the manifest itself before parsing. This can be
done even for https-based downloads in order to provide defense-in-depth
against a SSL attack. This CL adds the required verification logic in
update_engine, if such a manifest signature is present in the Omaha
response.

Until the delta generator is modified in a subsequent check-in to update
the manifest and payload with the required signature, none of this new
code will have any effect.

The delta generator change to populate non-zero values for these new
fields will follow in subsequent CLs.

BUG=chromium-os:33602
TEST=Tested on ZGB to make sure existing functionality works fine.
Added new unit tests.
Change-Id: I2d8b09c23faf87049893b1dee97a34e1f300aded
Reviewed-on: https://gerrit.chromium.org/gerrit/32844
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/update_attempter_unittest.cc
21be0753ca991afed45998ecd4c157c245f1fad0 26-Jul-2012 Jay Srinivasan <jaysri@chromium.org> Make sure waiting period in memory and persisted file are always in sync.

Sometimes the waiting period is 0 and there's no wall-clock-wait-period
prefs file created even though scattering is enabled. It happens because
the existing code doesn't maintain the invariants properly. So when a
user-initiated update check happens, the wall-clock-wait-period prefs
file is deleted but the in-memory variable
omaha_request_params_.waiting_period is not being updated.

This CL fixes these invariants by ensuring all the scattering artifacts
are removed completely when scattering is disabled and they're properly
recomputed when scattering is enabled.

BUG=chromium-os:32924
TEST=Updated unit tests, tested on ZGB.
Change-Id: Iabd2fd744f8c1a5099c00cf4d1f952757ec3e634
Reviewed-on: https://gerrit.chromium.org/gerrit/28348
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/update_attempter_unittest.cc
581c2ea71d31a8a1fd4aef49c923bf2b996f35d8 19-Jul-2012 Gilad Arnold <garnold@chromium.org> Modify a FilesystemCopierAction unit test.

* Reverse previous changes, which proved impotent in solving an
intermittent test failure.

* Disabled the failing test.

BUG=chromium-os:31082
TEST=Builds and runs unit tests

Change-Id: Ib7b3552e98ca40b6141688e2dea5a1407db12b2a
Reviewed-on: https://gerrit.chromium.org/gerrit/27910
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_attempter_unittest.cc
6dbbd397f5e1fea080a16ddaac41f9d92da159d4 11-Jul-2012 Gilad Arnold <garnold@chromium.org> Diagnose/eliminate FilesystemCopierAction unit test failure.

* Added a retry count for failed write operations: for the particular
failure at hand (an EIO return value on the last write call), we would
attempt to "rewrite" the buffer up to a given number of times. This
will tell us whether the error we're getting is transient or
persistent. This mechanism will try to reposition the output stream to
where it last succeeded, and re-mark buffer as full. The retry count
is zero for all instances of FilesystemCopierAction with the exception
of the instance used in RunAsRootSimpleTest (where it's set to 3).

Note, however, that we will keep failing to operation to ensure that
the unit tests are failing (and logs can be inspected). If this proves
to be a transient error that can be worked around via retry, we'll
probably leave this mechanism in place (but will stop failing the
action).

* Added a debug message that prints the number of bytes we're trying to
write when we attempt to write the residual (i.e. last piece of) data.
This is just to be sure that we're passing the correct number.

* Removed the random selection of data to be copied during
RunAsRootSimpleTest. It is obvious by now that only the sizes that are
not divisible by the (unknown but likely a reasonably large exponent
of two) fragment size are failing.

BUG=chromium-os:31082
TEST=Builds and runs unit tests

Change-Id: I3367eee638333686ab24997297d868cee416ff96
Reviewed-on: https://gerrit.chromium.org/gerrit/27094
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_attempter_unittest.cc
4348879380222dc8c74b0976e527bf3da66ba08f 19-Jun-2012 Jay Srinivasan <jaysri@chromium.org> UpdateEngine-side changes to allow updates over 3G based on device policy.

Some enterprise chromebooks have only 3G and hence they need the ability
to update over 3G if the enterprise policy allows that. This CL adds
the support in update_engine to enable that.

BUG=chromium-os:31099
TEST=Tested E2E on 3G, added unit tests and did regression testing.
CQ-DEPEND=I1a55a392f3dc0f12d917eb45dcf0456b57735514
Change-Id: I121bda35e54fa6c35e002a76db198d13b72b650e
Reviewed-on: https://gerrit.chromium.org/gerrit/25470
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/update_attempter_unittest.cc
08fce04e5341c99f308ee7462b1f351f5232eacd 08-Jun-2012 Jay Srinivasan <jaysri@chromium.org> Don't scatter during OOBE or user-initiated update checks.

We need to add logic to disable scattering of downloads if we are in OOBE
or if we're doing a manual update check.

Scheduled checks are already disabled during OOBE, but this extra check
will ensure that any scattering policy (there's a pending work item to get
policy during OOBE) during OOBE will have no effect on the update.

Similarly manual (i.e user-initiated) update checks through
update_engine_client or through Chrome UI should not honor scattering.
That way, this can serve as a simple user-friendly workaround in case
there's any bug in scattering logic that bricks the system by any chance.

BUG=chromeos-31563: Don't scatter during OOBE or manual update checks.
TEST=Updated unit tests. Tested all code paths manually on ZGB and Kaen.
Change-Id: Ib631e560c1f620ca53db79ee59dc66efb27ea83c
Reviewed-on: https://gerrit.chromium.org/gerrit/24564
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/update_attempter_unittest.cc
480ddfa079ebd01ed87e495332dec121d9ae781f 02-Jun-2012 Jay Srinivasan <jaysri@chromium.org> Scatter downloads to reduce bandwidth spikes.

Support in update_engine to honor the enterprise policy to scatter the
downloading of ChromeOS automatic updates so that we reduce bandwidth
spikes caused due to simultaneous downloads of updates by a large number
of enterprise devices.

This has no effect on consumer devices.

BUG=chromeos-29615: Implement scattering of downloads in UpdateEngine
TEST=Manually tested all scenarios, Unit tests added for all new code.
CQ-DEPEND=I1f56b5516970d5988eebb2cf8f93f6905823801d
Change-Id: I4a8f4974467a064d723ab13cbd78b1ca3ceff420
Reviewed-on: https://gerrit.chromium.org/gerrit/21574
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/update_attempter_unittest.cc
4d740ebe4fd3cef70d415113f427f64ee5e87f7e 15-May-2012 Gilad Arnold <garnold@chromium.org> Revised GPIO module interface + GPIO discovery logic

* The GpioHandler class is no longer a static singleton, rather an
ordinary object with a dynamic guard against multiple instances. This
makes testing/mocking a lot easier and simplifies implementation.

* It uses a basic, mockable udev interface; the module comes with
complete unit testing of the discovery mechanism.

* Corresponding changes to user classes, including UpdateAttempter and
UpdateCheckScheduler.

Note that the implementation of the test mode signaling protocol is
currently a no-op, always returning false, and hence has no effect on
the update process yet. This mechanism will be implemented in a later
CL.

BUG=chromium-os:25397
TEST=Builds and passes unit tests (including new ones)

Change-Id: I2f6254db6799ff5ef8616314890833f6e3269ff6
Reviewed-on: https://gerrit.chromium.org/gerrit/22869
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_attempter_unittest.cc
0a70874c61118a2b276edc731ad890c6826be2be 20-Mar-2012 Jay Srinivasan <jaysri@chromium.org> Implement the update engine portion for new enterprise policies.

Enterprises need the ability to stop the auto updates and pin clients
to a given target version. This CL adds support for these features in
the update_engine.

BUG=27307: Implement StopAutoUpdate based on enterprise policy
TEST=Added new unit tests, manually tested all cases on ZGB.
CQ-DEPEND=I523c3f67e0cb07fd24744dc0a30382ff2fe2128a
Change-Id: Id576401afc6d2c93f0e9ece7c6c0ddcf4b1bc00d
Reviewed-on: https://gerrit.chromium.org/gerrit/17867
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/update_attempter_unittest.cc
1ebd813ad19214d0b59ade04005c3b84ae765e42 05-Mar-2012 Gilad Arnold <garnold@chromium.org> GPIO test signal safe fallback + refactoring.

This addresses the problem of spurious GPIO signals indicating a test
scenario whereas in fact this isn't one, which may lead to hosts unable
to get an update (ZGB, Lumpy). This is also a partial fix to a problem
with Stumpy, where such spurious signals are inherent to the board
implementation.

* Safe fallback: a GPIO-signaled test scenario will be ignored other
than on the first time, in both places it is being checked
(UpdateAttempter::Update() and UpdateCheckScheduler::StaticCheck()).
This will ensure that we do not (a) override EULA/OOBE-complete flag
more than once; and (b) we do not attempt to update against a local
test server more than once. This generally covers against spurious
GPIO, as long as a user cannot trigger an update check on
a non-OOBE-complete system (appears to be a safe assumption).

* The retry timeout after failing an update with the test server is
shortened to 1 minute (compared to the default 45 minute). This
substantially increases the chances for a system exhibiting spurious
GPIO signals to get updates.

* Moved the GPIO functionality into a separate module/class. This makes
more sense now that it is being used by more than one class
(UpdateAttempter and UpdateCheckScheduler). The implementation of
GpioHandler has no instance data members and so behaves like
a singleton, but otherwise looks and feels like a normal class.

* Also changing the private test server URL to use an unregistered TCP
port (further reduces the chances of anything responding on the LAN).

* Some minor fixes.

BUG=chromium-os:27077, chromium-os:27109, chromium-os:25397,
chromium-os:27157

TEST=Unittests passed; GPIO reading + fallback work on x86-alex.

Change-Id: Ide1a60a690f1263efd47872360470347e56eeb45
Reviewed-on: https://gerrit.chromium.org/gerrit/17344
Commit-Ready: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/update_attempter_unittest.cc
7ed561bfe6019ed4b988142e97505d7c643e119c 04-Oct-2011 Darin Petkov <petkov@chromium.org> AU: Remove support for old-style updates.

This code is basically untested, unused and a security risk. So, remove...

BUG=chromium-os:12542
TEST=unit tests, tested VM update

Change-Id: Ibed0582b09497acef9debdf88658cddc2b5cecce
Reviewed-on: http://gerrit.chromium.org/gerrit/8728
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Ready: Darin Petkov <petkov@chromium.org>
/system/update_engine/update_attempter_unittest.cc
771e1bd1ed58ef791ccc41a2b9d96e257403abec 30-Aug-2011 Andrew de los Reyes <adlr@chromium.org> Make public key verification check binding.

Until now, we've just warned on failure. This CL makes the update fail
if the check fails.

BUG=chromium-os:19872
TEST=unittests; tested on device

Change-Id: I485b2548849f46d2b802c478736671bb44a85aab
Reviewed-on: http://gerrit.chromium.org/gerrit/6998
Reviewed-by: Darin Petkov <petkov@chromium.org>
Tested-by: Andrew de los Reyes <adlr@chromium.org>
/system/update_engine/update_attempter_unittest.cc
7fbbe8a9e57ec52f7bc597d0cb607036300ac54c 01-Aug-2011 Patrick Dubroy <dubroy@chromium.org> Update engine should use the release channel policy if it exists.

The release channel (aka update track) can be specified by a device
policy. When this is the case, the update engine should use the
value specified by the policy instead of the value specified in
/etc/lsb-release.

BUG=chromium-os:17015
TEST=Added two new tests:
- Added test that OmahaRequestParams uses the release channel passed
in to it when the value is valid, and otherwise uses /etc/lsb-release.
- Added test that the update engine correctly picks up the release
channel that's specified by the policy.

Change-Id: I2fe03712220bb3286476b12cd1f1b330ad006d7c
Reviewed-on: http://gerrit.chromium.org/gerrit/5072
Tested-by: Patrick Dubroy <dubroy@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
/system/update_engine/update_attempter_unittest.cc
18c7bce69dc040dc8e9c2a1dc207f7447fb06e84 16-Jun-2011 Darin Petkov <petkov@chromium.org> AU: Set error code bit 30 for error events on resumed updates.

BUG=chromium-os:16006
TEST=unit tests, tested on device

Change-Id: I94938529aa2cf2d85396a632d03624c71528b7f9
Reviewed-on: http://gerrit.chromium.org/gerrit/2786
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
/system/update_engine/update_attempter_unittest.cc
fb2f4614a4492f954c2e53a2797ef6be66e99b81 10-Jun-2011 Andrew de los Reyes <adlr@chromium.org> AU: Only retry HTTP connect failures when updating in background.

Interactive updates (those that come from dbus, rather than a timer)
will have the check for updates retry on failed HTTP connections only
once. We will still retry on connect failures for background updates 3
times, which is important for the case where a user has just woken
from sleep.

BUG=chromium-os:16255
TEST=unittests, on device test

Change-Id: I9cb0f854856846850cfdeaa4ffbe921d76eee15b
Reviewed-on: http://gerrit.chromium.org/gerrit/2449
Tested-by: Andrew de los Reyes <adlr@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
/system/update_engine/update_attempter_unittest.cc
e05fc28bf8c017174eba39109a806806172902f7 02-Jun-2011 Andrew de los Reyes <adlr@chromium.org> AU: Fixes for gcc-4.6

BUG=chromium-os:15111
TEST=unittests; followed instructions in Issue to compile w/ gcc-4.6

Change-Id: Ia16f9df22c2b85201938efd96799618172301d15
Reviewed-on: http://gerrit.chromium.org/gerrit/1965
Tested-by: Andrew de los Reyes <adlr@chromium.org>
Reviewed-by: Darin Petkov <petkov@chromium.org>
/system/update_engine/update_attempter_unittest.cc
116fda3221ff3df037ea1feb271883c87644c839 19-Apr-2011 Thieu Le <thieule@chromium.org> Add support to update_engine to poke Omaha after an update has been applied
successfully and is awaiting reboot to help ensure the number of actives
remains accurate.

BUG=chromium-os:12026
TEST=Manual test, unit tests

Change-Id: Ie3397264b0b34e8d423fb9748970f7d330122180

Review URL: http://codereview.chromium.org/6836025
/system/update_engine/update_attempter_unittest.cc
21816e18f2aa38e84206cfff7008748b93b61a13 07-Apr-2011 Andrew de los Reyes <adlr@chromium.org> AU: Detect and report public key verify failures, but continue updating.

Make a new OmahaEvent (Type: 14 (kTypeUpdateDownloadFinished), Result:
0 (kResultError), ErrorCode: 18
(kActionCodeDownloadPayloadPubKeyVerificationError)). This event is
sent if we have a successful download that fails public key
verification. Currently this is a non-fatal failure, but we plan to
make it fatal in future clients.

BUG=chromium-os:13341
TEST=unittests; 3 on device tests: w/o public key on device, w/ pub
key and matching download, w/ pub key and non-matching download

Change-Id: Ib6589c78449c2dfcbffa4c85ab679f7fe844584b

Review URL: http://codereview.chromium.org/6792065
/system/update_engine/update_attempter_unittest.cc
e6ef2f8bb08facf8939adc9a9e8c48912ffe0a3e 08-Mar-2011 Darin Petkov <petkov@chromium.org> Start action processing asynchronously in UpdateAttempter.

This is done so that we unblock the event loop on dbus calls.

BUG=chromium-os:12758
TEST=unit tests, tested updating the device

Change-Id: I38d9869afb392264a020fc6c653a20622fd38ada

Review URL: http://codereview.chromium.org/6624082
/system/update_engine/update_attempter_unittest.cc
000d895da247697f4e4e0c67a3a847f71fca8eb9 03-Mar-2011 Andrew de los Reyes <adlr@chromium.org> AU: Full proxy support

This CL Introduces a new proxy resolver that queries Chrome browser
for all URLs. This means the updater now works with Proxy
AutoConfiguration (PAC) files and automatic proxy detection.

BUG=chromium-os:9478
TEST=performed update, unittests

Review URL: http://codereview.chromium.org/6594025

Change-Id: I2c169aec06109e3eabc4011e0b536685dfd13f79
/system/update_engine/update_attempter_unittest.cc
3aefa8634c9e9f31b9fdae5a57444c70c2f03928 07-Dec-2010 Darin Petkov <petkov@chromium.org> AU: Split applied update verification into a separate step.

Use instances of FilesystemCopierAction to do applied update verification. This
speeds it up slightly because asynchronous reads happen in parallel with hash
calculation but, more importantly, makes update_engine be responsive to D-Bus
during that step.

BUG=9140
TEST=unit tests, tested on device

Change-Id: I3ec9445de5e8258a63433a61f1a476aef4434f6c

Review URL: http://codereview.chromium.org/5516009
/system/update_engine/update_attempter_unittest.cc
1b0031066aa2e38036a8a84458ea8abac90b2e04 30-Nov-2010 Darin Petkov <petkov@chromium.org> AU: More UpdateAttempter unit tests.

BUG=6243
TEST=unit tests

Change-Id: I364cf8f4744098e45a6537bb89c6cabf92f3889c

Review URL: http://codereview.chromium.org/5301002
/system/update_engine/update_attempter_unittest.cc
4516810fe41a39c0c55d2095679898787259ae38 22-Nov-2010 Andrew de los Reyes <adlr@chromium.org> AU: Manual proxy support

Utilize the ChromeProxyResolver to resolve proxies in our network
requests. This means the following changes:

- HttpFetcher classes take a ProxyResolver* in their ctor. Also, a few
useful functions in HttpFetcher to allow subclasses to iterate
through the proxies.

- LibcurlHttpFetcher support for using the ProxyResolver. It will
attempt to use each proxy in the order specified. If any data comes
in from any proxy, it won't continue down the list and will continue
to use that proxy for its lifetime.

- UpdateAttempter can choose, for a given update session, whether or
not to use the ChromeProxyResolver or DirectProxyResolver. For now,
the logic is: for automatic checks, 80% of the time use
ChromeProxyResolver, 20% DirectProxyResolver. For manual checks, the
first 19 manual checks in a row use Chrome, then once it uses
Direct, then starts over again. The idea is that the updater doesn't
necessarily trust Chrome, so some requests should skip it. If a
manual check is performed, the user likely wants her proxy settings
honored, so use them, but don't allow frequent manual checks to
starve out usage of the DirectProxyResolver.

- Updates to tests

BUG=3167
TEST=unittests, tested on device

Review URL: http://codereview.chromium.org/5205002

Change-Id: Iee0f589e5b28d4b804afe1f5b6729ba066d48d62
/system/update_engine/update_attempter_unittest.cc
9c096d6691414d32dee22e083ac8e2e8d24b0880 17-Nov-2010 Darin Petkov <petkov@chromium.org> AU: Use NiceMock<PrefsMock to suppress uninteresting call warnings.

BUG=9292
TEST=unit tests

Change-Id: I16088d203fb195e7cd3b321f3ed9b3793e8980bf

Review URL: http://codereview.chromium.org/5141004
/system/update_engine/update_attempter_unittest.cc
6d5dbf6458d55db480ebaa1b6fc3152631f722ad 09-Nov-2010 Darin Petkov <petkov@chromium.org> AU: Remove obsolete postinst --postcommit call.

BUG=6251
TEST=unit test, tested update on device

Change-Id: Ib44b4698cab5fa1f2d0b5afd04dca500c8dbe84c

Review URL: http://codereview.chromium.org/4679003
/system/update_engine/update_attempter_unittest.cc
d34a4211059ad2687d605939c4bc42daf6e92940 09-Nov-2010 Darin Petkov <petkov@chromium.org> AU: Remove obsolete SetBootableFlagAction.

BUG=6251
TEST=unit tests, tested on device

Change-Id: If1b28d47287abeb0a507d77aa3790fdf39d6513a

Review URL: http://codereview.chromium.org/4719002
/system/update_engine/update_attempter_unittest.cc
2dd0109675fac379289a9d092fa4a6f6e05e0038 09-Oct-2010 Darin Petkov <petkov@chromium.org> AU: Verify that the applied delta update matches the server-sent hashes.

Also, don't try to resume any delta update that fails for any reason
other than download transfer errors.

BUG=7348
TEST=unit tests, gmerged on device

Change-Id: Ice464b8d421256717d7909fd5fa46d762bd48952

Review URL: http://codereview.chromium.org/3599025
/system/update_engine/update_attempter_unittest.cc
73058b421f91e04cc605c2a113e0010009a63594 07-Oct-2010 Darin Petkov <petkov@chromium.org> AU: Start checkpointing update progress.

Checkpoint the manifest metadata size and the update
check response hash in the preference store. Also checkpoint
the next operation and data offset.
Add methods for getting/setting hash context.

BUG=7390,7394
TEST=unit tests

Change-Id: I25291bf598ac9b0f1033e11cfe59df45b1f6eeab

Review URL: http://codereview.chromium.org/3521016
/system/update_engine/update_attempter_unittest.cc
362757765e7697dd93e8de05fa0a59f29242eb89 01-Oct-2010 Darin Petkov <petkov@chromium.org> AU: Fall back to full updates after a number of failed delta update attempts.

Count each failed delta update attempt. Keep the count in persistent storage. If
the count exceeds a threshold (3), disable delta updates by setting delta_okay
to false in the update check request.

Once this CL is in, we have to ensure that we have a full update payload
available on the update server for each version otherwise we may orphan clients.

BUG=7221
TEST=unit tests, gmerged on device and tested with a mod'ed dev server

Change-Id: I7f7fa73f652f12f22cc8604dad6a26c802b8582d

Review URL: http://codereview.chromium.org/3617002
/system/update_engine/update_attempter_unittest.cc
cd1666f5c1be2745197046a55b2fdde7b6045604 23-Sep-2010 Darin Petkov <petkov@chromium.org> AU: move AU completed marker from /tmp to /var/run since /var/run is root-only.

BUG=6578
TEST=unit tests, gmerged on device, updated, restarted update engine and
checked status

Change-Id: If703b66f1bf6efa13f25225d3c5868bc3dd190b7

Review URL: http://codereview.chromium.org/3404015
/system/update_engine/update_attempter_unittest.cc
f42cc1c604fe5b0be29847a24f9bd5acf42ba394 01-Sep-2010 Darin Petkov <petkov@chromium.org> AU: Start an UpdateAttempter unit test suite.

This increases the UpdateAttmpter line coverage to almost 40%. More is needed
but this is a good starting point / checkpoint. Also some UpdateCheckScheduler
unit test cleanup.

BUG=6243
TEST=unit tests, gmerge on device

Change-Id: I39c80de3f18095c4a28cb36ab868bed6d7073824

Review URL: http://codereview.chromium.org/3259011
/system/update_engine/update_attempter_unittest.cc