History log of /system/update_engine/omaha_request_action_unittest.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
00adf7b3141e05051eeeffb57056ffbe67eacfb9 27-Jun-2017 Sen Jiang <senj@google.com> Don't update if any app has status="noupdate".

Only update if all apps have status="ok" and at least one app doesn't
have noupdate="true".

Bug: 62985600
Test: update_engine_unittests
Change-Id: I4171989e474408cea914e97f408db2ec83a94d8c
(cherry picked from commit d869bd816b8635ed2df5b2b74fdebe393bdcbd90)
/system/update_engine/omaha_request_action_unittest.cc
cdd5206c6507fa5c70344c269053d30777f7d674 19-May-2017 Sen Jiang <senj@google.com> Support IsDeltaPayload per <package>.

Mixed full and delta payloads are now supported for multi-payload.

Bug: 36252799
Test: update_engine_unittests
Change-Id: Ic519f8399579c714a65ba9f9f948a389fcc249ed
(cherry picked from commit 4928112f8635f7a5b583171640aee2bda690ba34)
/system/update_engine/omaha_request_action_unittest.cc
81259681c4cd634c79c657c81f270348fcb5ec80 31-Mar-2017 Sen Jiang <senj@google.com> Parse multiple <app> tag.

SoM and product will have different app id in Android Things, and in
Omaha response they will be in separate <app> tag.
Each <app> will have its own <urls>, <packages>, <actiions>, etc.

Bug: 36252799
Test: update_engine_unittest
Change-Id: I47f46155a7362dba2a3010b4372a8f254c78fb30
(cherry picked from commit 558084b960a1b0a81e43395c12400c54a4b0c3c0)
/system/update_engine/omaha_request_action_unittest.cc
0affc2c099fac47b999ba39f8f1bacb418e65a97 11-Feb-2017 Sen Jiang <senj@google.com> Parse multiple packages from Omaha response.

The multi-payload info are stored in OmahaResponse and InstallPlan, but
we still can only apply the first payload for now.

Bug: 36252799
Test: mma -j
Test: update_engine_unittests

Change-Id: I5ca63944ae9082670d0e67888409374f140d4245
(cherry picked from commit 2aba8a87d4fac245a2e2d238b3159f8eabce630f)
/system/update_engine/omaha_request_action_unittest.cc
2703ef4466066d64d8021904e233b120f38c0272 16-Mar-2017 Sen Jiang <senj@google.com> Store raw payload hash blob in install plan.

We were using a custom sha256 pair in Omaha response, now that Omaha
has a standard hash_sha256 field in package, we should use that instead.

The difference is that hash_sha256 is encoded in hex instead of base64,
but the android payload property is still using base64, to be backward
compatible, we have to keep accepting base64 there, to avoid decoding
and then re-encoding to another encoding, we store the decoded raw hash.

Also removed the hash() related functions in HashCalculator, since it's
rarely used and the caller should encode it in whatever encoding they
want.
Also make use of RawHashOfBytes to simply code in a few places.

Bug: 36252799
Test: update_engine_unittests
Change-Id: Iaa02611b4c9cda3ead5de51e777e8caba6d99d93
(cherry picked from commit f14d51b6823522f6b2eb834f9e14d72c8363a3ad)
/system/update_engine/omaha_request_action_unittest.cc
5688d16057d34b770c070e2b4a27841092003a4e 06-Jun-2017 Tao Bao <tbao@google.com> Revert "Add functions to allow update over cellular (including tethered connection)"

This reverts commit 4b0d6032cbb86ce488c03b31936cda31283f97e3.

Bug: 62366504
Test: GmsCore sees the old status code (i.e. UPDATED_NEED_REBOOT == 6).
Change-Id: I9185614a41bd621ad85e7f773b0f96919b0f70d5
/system/update_engine/omaha_request_action_unittest.cc
4b0d6032cbb86ce488c03b31936cda31283f97e3 17-Apr-2017 Weidong Guo <weidongg@chromium.org> Add functions to allow update over cellular (including tethered connection)

- Add an update state NEED_PERMISSION_TO_UPDATE which is broadcasted along
with the update info (version and size) when |OmahaRequestAction| aborts
update due to cellular connection. So the state transition will be:
IDLE->CHECKING_FOR_UPDATE->NEED_PERMISSION_TO_UPDATE->REPORTING_ERROR_EVENT
->IDLE
(The Chrome UI prompts an alert window showing update size and asks user
whether to proceed upon receiving this state.)

- Add a dbus interface to set update over cellular target
(kPrefsUpdateOverCellularTargetVersion and kPrefsUpdateOverCellularTargetSize).
The target is the one received by Chrome UI in NEED_PERMISSION_TO_UPDATE
broadcast. By sending the target back with the dbus call, update engine can
double check the target with the server to make sure there's no new server
push after NEED_PERMISSION_TO_UPDATE is broadcasted to Chrome UI.
(This dbus call is invoked when the user chooses to proceed to update at the
alert window. The dbus call is followed by another dbus call |AttemptUpdate|)

- So, the the decision tree as to whether to allow update over cellular
connection has changed to:
IF (device policy DeviceUpdateAllowedConnectionTypes set)
follow device policy's decision
ELSE IF (kPrefsUpdateOverCellularPermission set to true)
allow update
ELSE IF (Either kPrefsUpdateOverCellularTargetVersion or
kPrefsUpdateOverCellularTargetSize is not set, or they are set but do not
match the version and size in |OmahaResponse| retrieved by
|OmahaRequestAction|)
disallow update, and broadcast NEED_PERMISSION_TO_UPDATE
ELSE
allow update
ENDIF

- This decision making happens at |OmahaRequestAction| after |OmahaResponse| is
retrieved. Since we want to separate the device policy check with the user
preferences check which depends on |OmahaResponse| during checking for update,
we modify ConnectionManager::IsUpdateAllowedOver by moving the user preferences
check to |OmahaRequestAction|. Thus, the function by default returns true for
cellular connection if device policy is not set.

- Corner case:
Adding kPrefsUpdateOverCellularPermission and
kPrefsUpdateOverCellularTargetSize seems to complicate the logic here. But
they could effectively solve a corner case where the target does not match
|OmahaResponse| due to new server push after broadcasting
NEED_PERMISSION_TO_UPDATE. In that case, we simply broadcast
NEED_PERMISSION_TO_UPDATE again along with new update info.

CQ-DEPEND=CL:481102
BUG=chromium:691108
TEST='FEATURES=test emerge-link update_engine'

(cherry picked from commit 70063d9f7e229db8c5b42443ca96ac23a971a6dd)
Cherry-pick updated to compile on Android.

Reviewed-on: https://chromium-review.googlesource.com/479467
Commit-Ready: Weidong Guo <weidongg@chromium.org>
Tested-by: Weidong Guo <weidongg@chromium.org>
Reviewed-by: Weidong Guo <weidongg@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Reviewed-by: Ben Chan <benchan@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
f1cf34849efdc0158fb1987ba74a51f25016c5bd 19-Jul-2016 Luis Hector Chavez <lhchavez@google.com> update_engine: Update libchrome APIs to r405848

The new libchrome has been ported from Chromium and some APIs have
changed. Make necessary changes at call sites.

Notable changes from libchrome:
- base::Bind() now explicitly disallows captures in lambdas (which was
never allowed in the style guide), so lambdas should now be written in
a way that take the captures as parameters.

Bug: 29104761
Test: All tests in update_engine_unittest pass on dragonboard-eng build
Change-Id: Iec04c126630fd876114076e3cb10cf917c8817b0
/system/update_engine/omaha_request_action_unittest.cc
7c1171e41da9db6be18e34f40047ff80da782af0 23-Jun-2016 Sen Jiang <senj@google.com> Fix OmahaRequestActionTest when the device time is very old.

Changed OmahaRequestAction to use the ClockInterface instead so that
it can be faked in the unittests.

Test: ./update_engine_unittests
Bug: 29577823

Change-Id: If243aa3beae973606ace226a7845ca5a6b02225f
/system/update_engine/omaha_request_action_unittest.cc
14ad88ea53bd89f9c6e477e28745c4506c2f0f81 29-Jun-2016 Alex Deymo <deymo@google.com> Set X-GoogleUpdate headers on Omaha requests.

When sending requests to Omaha, set the custom X-GoogleUpdate-* headers
to help identify the request type without parsing the actual request.

Bug: 28823234
TEST=Added unittests.

Change-Id: I4f0d64b4fc0f69e8a5d4b86337331a3a7a481b35
/system/update_engine/omaha_request_action_unittest.cc
255e22b82af3a52218eaea66acc734ec25cfeab6 21-May-2016 Sen Jiang <senj@google.com> Move ParseConnection*() to connection_utils.

We don't need real_shill_provider if USE_DBUS is 0, but we still need
these functions, and they have a duplicate copy in connection_manager,
so put them in utils and deduplicate.

Also moved StringForConnectionType() to connection_utils.

Bug: 28800946
Test: mma

Change-Id: If535fdc52bc8fb267921bea02b31d8d6580d5d54
/system/update_engine/omaha_request_action_unittest.cc
46a9aae85e78179a0acd0d1efd1d99685fb827bb 05-May-2016 Alex Deymo <deymo@google.com> Fix non-critical updates on boards without an OOBE flow.

A recent change in the policy made update_engine to ignore available
updates if the OOBE flow is not completed and the update is not
critical. Nevertheless, some custom boards don't have a OOBE flow as
Chromebooks do and set is_oobe_enabled=false in the policy manager.
These board were not getting regular updates because the OOBE flow is
considered not completed in those cases.

This patch moves the is_oobe_enabled flag to the HardwareInterface class
together with the IsOOBEComplete() method and updates the callers to
check the IsOOBEEnabled() value before.

Bug: 28460247
Bug: 28553821
TEST=Added unittest for the disabled and not complete case.

Change-Id: Ifd3ac2dc5e7a43f6c24eb014b7e3eacad22e3ab3
/system/update_engine/omaha_request_action_unittest.cc
b3fa53bf760bd0a6fd1ef9df28cb425586d733f6 19-Apr-2016 Alex Deymo <deymo@google.com> Parse and expose end-of-life flag.

Omaha update or noupdate response can include _key=value pairs with
arbitrary data. One of those key can be "_eol" with the one of the
values "supported", "security-only" or "eol" which notifies the device
the end-of-life status of the device with respect to updates. This
information is now exposed via GetEolStatus() to the client so it
can be properly displayed in the UI.

Bug: 27924505
TEST=Added unittest. Run `update_engine_client --eol_status` on link.

Change-Id: Icc15f25b4d0b19cc894f5afc52ac7c43c7818982
/system/update_engine/omaha_request_action_unittest.cc
297e583af1cec04f5f332b57b91f846921744c91 17-Mar-2016 Sen Jiang <senj@google.com> Fix OmahaRequest unittests in Brillo.

Moved lsb_release related tests to ImagePropertiesTest.

Bug: 26955860
Test: GTEST_FILTER="Omaha*" ./update_engine_unittests
Test: cros_workon_make update_engine --test

Change-Id: I124c9374e7556b04c65bdac80e1b89064dee4008
/system/update_engine/omaha_request_action_unittest.cc
2494e28b88a819618c6325a5b081ef7de28549ee 30-Mar-2016 Kevin Cernekee <cernekee@google.com> Skip non-critical updates during OOBE update check

If the system has not yet completed OOBE, and Omaha returns a response
with an empty deadline field, avoid initiating a background update
because doing so may violate an enterprise policy that gets pushed
down post-enrollment.

Bug: None
BUG=chromium:587101
TEST=`FEATURES=test emerge-link chromeos-base/update_engine`
TEST=powerwash, install lsb-release file from an old stable build,
repeat OOBE, verify that download is skipped via logs, then verify
that update proceeds after logging into a standard gmail account

Change-Id: I6e6fae02c609b2763abc6e9960bf6d87dd3534e2
/system/update_engine/omaha_request_action_unittest.cc
72a2567a03afbe07c3810be28bcad477268ab4df 23-Mar-2016 Alex Deymo <deymo@google.com> Fix unittests when OmahaEvent fails.

The test was expecting the crashing callback to be pending, which now
no longer exists.

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

Change-Id: I568647d831035ee639bed626ed92de3b69277858
/system/update_engine/omaha_request_action_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/omaha_request_action_unittest.cc
0057daa5dd6adc2db3b5524cfb3e66011c69c152 24-Jan-2016 Alex Vakulenko <avakulenko@google.com> update_engine: Fix build breaks in unit tests on Chrome OS

Some unit tests that compile only on Chrome OS were broken.

Change-Id: I47b27ec49f11137e7549da0b7a8d2d6d9fef768c
/system/update_engine/omaha_request_action_unittest.cc
0103c36caa2e38e034e0d22185736b9ccfb35c58 20-Jan-2016 Alex Vakulenko <avakulenko@google.com> update_engine: Update libchrome APIs to r369476

The new libchrome has been ported from Chromium and some APIs have
changed. Make necessary changes at call sites.

Change-Id: I42e65bda7f1dbdf6f6e0ebf356d2cfea6b729193
/system/update_engine/omaha_request_action_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/omaha_request_action_unittest.cc
38429cf76aaac8c499004b6f537229a26b381602 12-Nov-2015 Alex Deymo <deymo@google.com> common: Split out metrics utils from utils.cc.

The utility functions to convert error codes and network settings to
the types defined by the metrics framework are split out the utils.cc
file. These tools are only used by the update_engine daemon to report
back metrics on an update check.

Bug: 25197634
Test: FEATURES=test emerge-link update_engine; mma

Change-Id: I589dc9f6056fb1399fa84ca4f44076ed3a6b5365
/system/update_engine/omaha_request_action_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/omaha_request_action_unittest.cc
9fded1eee295295d33da477f00d9c9a240623e91 05-Nov-2015 Alex Deymo <deymo@google.com> Send Omaha event_type 54 after reboot to new update.

When rebooting to a new version, we were sending an Omaha event_type 3
to flag a "success reboot". Nevertheless, the server expect us to send
only one event_type 3 for every <updatecheck> response with a payload
but we were sending one event_type 3 upon payload application and
another one after reboot.

This patch changes the event_type sent after reboot to 54, a value
reserved from Chromium OS clients.

Bug: None
Test: Added unittest.

Change-Id: I199a2b00c702175762f2c154ca2f45b3f6ad768c
/system/update_engine/omaha_request_action_unittest.cc
efb9d8394c58054cc8ebe1efd0fd2c5e7b4b344a 03-Nov-2015 Alex Deymo <deymo@google.com> Fix OmahaRequestAction unittest.

The unittest OmahaRequestActionTest.FormatUpdateCheckOutputTest was
incorrectly expecting the previous version to be set even if it wasn't
an update to a new update.

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

Change-Id: I90d7d1cb24929f1c7d9d581dcccdd53a3a315ab5
/system/update_engine/omaha_request_action_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/omaha_request_action_unittest.cc
856166594771c61973856f563e622ccb7dd48aa1 16-Oct-2015 Alex Deymo <deymo@google.com> Read ProductId, ProductVersion and Channel setting in Brillo.

The ProductId, ProductVersion and current/target channels are specified
in a very different way in Brillo compared to Chrome OS. This patch
moves the logic to read and parse /etc/lsb-release in Chrome OS to a
new image_properties module and implements the equivalent module in
Brillo.

This new module replaces some of the logic previously in the
OmahaRequestParams class, both for parsing the read-only properties
from the rootfs and parsing and storing the target channel in the
stateful partition. The Chrome OS version of the new module keeps the
same behavior, except that it falls back to "stable-channel" if the
the current channel is missing in the rootfs (unlikely in Chrome OS).

On the other hand, the new Brillo implementation reads these settings
from the /etc/osrelease file and /etc/osrelease.d directory and doesn't
allow to override those setting during development. The persisted
target_channel and powerwash_allowed settings are stored in Prefs
as many other settings. Finally, since Brillo images don't contain
a channel name baked in the image, we store the channel name where we
got the image from at the time of the update. The first boot after
provisioning will default to "stable-channel".

Bug: 25013069
Test: unittest in Chrome OS; `mm` and tested on a Brillo device.

Change-Id: Icc114b8098af3edaaba715c9c2e3ebe9f417c876
/system/update_engine/omaha_request_action_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/omaha_request_action_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/omaha_request_action_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/omaha_request_action_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/omaha_request_action_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/omaha_request_action_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/omaha_request_action_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/omaha_request_action_unittest.cc
75eac7e523f825afdb88508922d7dc65fa366b19 29-Jul-2015 Alex Deymo <deymo@chromium.org> update_engine: Convert NetworkConnectionType to enum class.

This patch simply converts the old NetworkConnectionType enum to an
enum class and updates all the callsites and formatting.

BUG=None
TEST=emerge-link update_engine.

Change-Id: I29a281f1648e2d8ef74b1046d01a212022280461
Reviewed-on: https://chromium-review.googlesource.com/289585
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>
Trybot-Ready: Prathmesh Prabhu <pprabhu@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
00d79acf5b081e80978fb0e07caeae77b99f0372 30-Jun-2015 Alex Deymo <deymo@chromium.org> update_engine: Persist cohorts sent by omaha even if there's no update.

Omaha can set the cohorts in the <appid> tag even if there's no update and
update_engine should persist them. This patch fixes that case and adds a test
for it.

BUG=chromium:503728
TEST=Added unittest.

Change-Id: I23c13645557396704107a2a0c2c420f536a52b03
Reviewed-on: https://chromium-review.googlesource.com/282591
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/omaha_request_action_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/omaha_request_action_unittest.cc
cc4578542d44889453db197672c97d8c3d3d9a1e 19-Jun-2015 Alex Deymo <deymo@chromium.org> update_engine: Remove g_markup_escape_text usage.

g_markup_escape_text() is used to encode attributes before assembling
them in a XML request. To remove this dependency on glib we re-implement
it here.

BUG=chromium:499886
TEST=Unittest still pass. Updated with more cases.

Change-Id: Ib0b8e603c779741b7463a823dd8e94b3abf68525
Reviewed-on: https://chromium-review.googlesource.com/280585
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
b0d74eb91183eef5955974c515e40c994098372f 31-Mar-2015 Alex Deymo <deymo@chromium.org> update_engine: Check XmlEncode() input strings.

XmlEncode() only supports valid UTF-8 string. Incomplete UTF-8 strings
would make it crash.

This patch limits the input string to ASCII-7 and falls back to a
default string value whenever an invalid one is found. Some of these
values come from the stateful partition, which would make the
update_engine fail forever.

BUG=chromium:471925
TEST=Added unittests.

Change-Id: I01c5da1b44462a0fe1eb703106a9d0dd3051100b
Reviewed-on: https://chromium-review.googlesource.com/263154
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
8e18f931f634d7c3b3a5fcbfc057e79fa9d6fb80 28-Mar-2015 Alex Deymo <deymo@chromium.org> update_engine: Add Cohort, CohortName, CohortHint to Omaha protocol.

This patch persists and sends back to omaha the cohort, cohorthint and
cohortname arguments in the <app> tag. To avoid problems, these strings
are limited to 1024 chars.

BUG=chromium:448995
TEST=unittest added.

Change-Id: I05e7677ee43ab795b670b274d3984803cb6b9522
Reviewed-on: https://chromium-review.googlesource.com/262967
Trybot-Ready: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
f68bbbc952aa9a71898e4939b5f36187fa564a50 09-Feb-2015 Alex Vakulenko <avakulenko@chromium.org> update_engine: replace std::vector<char> with chromeos::Blob

To make update engine consistent with the rest of platform2 code
replaced std::vector<char> as the container of binary data with
chromeos::Blob.

BUG=None
TEST=`FEATURES=test emerge-link update_engine`

Change-Id: I6385fd2257d15aa24bfa74ac35512c2a06c33012
Reviewed-on: https://chromium-review.googlesource.com/247793
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
35866ed08bcefa9d8bffab9ca64cf994ad0f4290 29-Jan-2015 Yunlian Jiang <yunlian@google.com> update_engine: fix -Winconsistent-missing-override warning

BUG=chromium:453566
TEST=FEATURES="test" emerge-amd64-generic update_engine

Change-Id: Icf889d01021993e6b3175b3a15efe82069d2d2fc
Reviewed-on: https://chromium-review.googlesource.com/244411
Reviewed-by: Alex Deymo <deymo@chromium.org>
Tested-by: Yunlian Jiang <yunlian@chromium.org>
Commit-Queue: Yunlian Jiang <yunlian@chromium.org>
/system/update_engine/omaha_request_action_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/omaha_request_action_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/omaha_request_action_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/omaha_request_action_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/omaha_request_action_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/omaha_request_action_unittest.cc
ebbe7ef75279183ba3cf055158dbbb3b3b605e0e 30-Oct-2014 Alex Deymo <deymo@chromium.org> update_engine: Don't sent <ping a=-1 r=-1> once the device was powerwashed.

When a device is first activated, a <ping a=-1 r=-1> is sent to Omaha
indicating this is a new device activation. After that point, the
active days count will be positive since Omaha sends back the daystart
tag which will be used in the future to compute the non-negative
"a=" and "r=" values.

Nevertheless, when a device is powerwashed, the daystart data is lost
and the first login will trigger a "new device" activation, counting
the same device as two activations in the Omaha side.

This patch uses the powerwash_count file stored in stateful partition
to detect if the new device activation is performed on a device that
was powerwashed at some point and thus doesn't send the a=-1 and r=-1
ping to Omaha. The powerwash_count is generated or incremented
whenever a "safe" powerwash is performed (such as the one that
update_engine triggers on some channel changes). Going to dev mode
and back, going through recovery with an USB key or doing a
"factory" powerwash (done in the factory) *will* wipe this powerwash
count and send the device back to a factory state.

BUG=chromium:428792
TEST=Manual test.

Manual test procude:
1. Run recovery. Check /mnt/stateful_partition/unencrypted/preserve/powerwash_count
is not present.
2. Login for the first time.
3. Check /var/log/update_engine.log shows a '<ping' with 'a="-1" r="-1"' being sent.
4. Powerwash ( echo "safe fast keepimg" > /mnt/stateful_partition/factory_install_reset )
5. Reboot
6. Login for the first time again.
7. Check /var/log/update_engine.log shows doesn't show a '<ping' with 'a="-1" r="-1"'

Change-Id: I1a823040d2da43b93f14241bc521087ce2a2d4f2
Reviewed-on: https://chromium-review.googlesource.com/226716
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
e1e3afe30a214b3661a36474c1448f520662f33c 30-Oct-2014 Alex Deymo <deymo@chromium.org> update_engine: Cleanup omaha_request_action_unittest.cc.

This patch is a cleanup of the omaha_request_action_unittest. First
it moves members common to all test from the global scope to the
OmahaRequestActionTest class, including the global scope
FakeSystemState instance used on all tests. This fake_system_state
is initialized with a default OmahaRequestParams that is used by many
tests not caring about that parameter. It also sets the default prefs
to a FakePrefs instance, removing the need to create a temp directory
and initialize it in every test. Some tests still replace it with a
MockPrefs when they need to test that some prefs are checked by the
code (testing interaction), but most of them just want to provide a
working Prefs class.

With this change, also the test helper functions were moved to the
OmahaRequestActionTest class, removing the need to pass the optional
classes such as PrefsIterface, PayloadStateInterface, P2PManager and
ConnectionManager which in most tests were passed as nullptr meaning
that the default is used. Instead, with this change, tests that
require a different P2PManager instance for example just create it
and replace it on the fake_system_state_.

This change removes a lot of redundant default code that was hard to
maintain. Now a test requiring to manipulate other classes in the
FakeSystemState class, such as mocking out the HardwareInterface, can
just replace that without adding another parameter to the helper
functions.

BUG=chromium:428792
TEST=Unittest still pass.

Change-Id: Ia3306b11af867d2a1a09be8efae66f6b0326f030
Reviewed-on: https://chromium-review.googlesource.com/226715
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: Alex Deymo <deymo@chromium.org>
Tested-by: Alex Deymo <deymo@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
afd70ed1393d936579acbd9242c326be47213a69 01-Oct-2014 Gilad Arnold <garnold@chromium.org> update_engine: Remove legacy logic and tests.

This removes logic that was used for tracking whether updates were
disabled by device policy, and unit tests that checked for the presence
of such logic. This logic is now part of the Update Manager's
UpdateCheckAllowed policy request. It is safe to remove the old check
because it'll always conclude that the update request can be sent, given
that the said policy has concluded the same.

BUG=None
TEST=Unit tests.

Change-Id: Ibbb3728f7239f608a6317bc5a8b76cac7f54bc5f
Reviewed-on: https://chromium-review.googlesource.com/220876
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/omaha_request_action_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/omaha_request_action_unittest.cc
f3e2801f18bae14e41099e007de7c9a019735556 27-Aug-2014 David Zeuthen <zeuthen@chromium.org> update_engine: Reject XML with internal entity declarations.

This helps avoid resource exhaustion problems.

BUG=chromium:406546
TEST=New unit test + unit tests pass.

Change-Id: Ib54f378cf533c200631b274c0414075c2ea4ff67
Reviewed-on: https://chromium-review.googlesource.com/214291
Reviewed-by: Chris Masone <cmasone@chromium.org>
Reviewed-by: Alex Deymo <deymo@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/omaha_request_action_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/omaha_request_action_unittest.cc
e8ed86367d92d1f30f340ad28e841846ae58bc61 24-Jul-2014 David Zeuthen <zeuthen@chromium.org> update_engine: port from libxml2 to expat.

This allows us to remove libxml2 from the OS and thereby save a couple
of MB of disk space.

BUG=chromium:293137
TEST=Unit tests pass + manual testing.
CQ-DEPEND=CL:209651

Change-Id: I2469f1862dd7e25dd6684640a755745f09b4db06
Reviewed-on: https://chromium-review.googlesource.com/209770
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/omaha_request_action_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/omaha_request_action_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/omaha_request_action_unittest.cc
77f79e876a77796fc248d099b6574f05bd23c954 03-Jun-2014 Chris Sosa <sosa@chromium.org> Only disable update downloads over expensive connections, not all transfers.

Previous to this CL, all network traffic was disabled from the update engine
if an update wasn't allowed. Instead, in this CL, we switch to only disable
the update application portion (downloading and applying the payload). This
is done by moving the detection logic from the mechanism (the network fetcher)
to the user of said mechanism i.e. the omaha request/response actions.

I have done a little refactoring of the unittests to make this CL easier to
test and found 1 bug in the http_fetcher_unittests where we weren't sending
either the right URL or handling a server not existing correctly.

This CL comes with one caveat:
Technically in the previous impl if a download started over wifi then got
disconnected / retried and bounced to a different connection type that
we couldn't update over, we'd stop the update. This would no longer be true
here if the http_fetcher recovered seamlessly.

BUG=chromium:379832
TEST=Unittests

Change-Id: I6b1a76e4c030d4e384e8ba0b519424a35406aafb
Reviewed-on: https://chromium-review.googlesource.com/202435
Tested-by: Chris Sosa <sosa@chromium.org>
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
/system/update_engine/omaha_request_action_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/omaha_request_action_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/omaha_request_action_unittest.cc
c0dd0210d01406df4b88086ea1349a75b8fe0584 04-Apr-2014 David Zeuthen <zeuthen@chromium.org> metrics: Use sparse histogram for metrics::DownloadErrorCode values

This was pointed out by asvitkine@ when reviewing the histograms.xml
change. Thanks!

BUG=chromium:355745
TEST=Unit tests pass.

Change-Id: I3bb49210d0e9bc443546d05f3597590ec7814841
Reviewed-on: https://chromium-review.googlesource.com/193274
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/omaha_request_action_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/omaha_request_action_unittest.cc
33bae491eded4ef4f1eb4f4ef0f01ef0e5463f3a 26-Feb-2014 David Zeuthen <zeuthen@chromium.org> Add new metrics.

The current metrics (Installer.* namespace) have several shortcomings,
for example it's not immediately clear when and how frequent each
metric is reported. This CL introduces new metrics that addresses this
and other problems. The new metrics are all in the UpdateEngine.*
namespace and fall into five categories

UpdateEngine.Daily.* Reported daily.
UpdateEngine.Check.* On every check.
UpdateEngine.Attempt.* On every attempt.
UpdateEngine.SuccessfulUpdate.* With every successful update.
UpdateEngine.* Miscellaneous

Most of the new metrics mimic existing metrics and also leverage the
existing code, book-keeping and unit tests. The plan is to remove the
Installer.* metrics once we're happy with the new ones.

I've also tested this manually by performing updates and verifying
that chrome://histograms looks correct.

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

Change-Id: I7a3f68d75910384b116c7e4664776e25d3997584
Reviewed-on: https://chromium-review.googlesource.com/191314
Reviewed-by: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/omaha_request_action_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/omaha_request_action_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/omaha_request_action_unittest.cc
4cc5ed215180d19598d8b99f0a8a15cc24b831fc 15-Jan-2014 David Zeuthen <zeuthen@chromium.org> p2p: Pass proper wait-in-line timeout.

Use TimeDelta::FromSeconds(), not TimeDelta::FromHours(), when passing
a number of seconds. With this change we get the 6 hour timeout that
we want instead of a 6*3600 = 21600 hours = 900 days = 3+ years
timeout. (Ouch.)

Also add a unit-test for checking that the right value is passed.

Curiously enough, even with this bug we were still seeing 4.78%
cancelations in the P2P.Client.LookupResult metric including
corresponding samples in the P2P.Client.Canceled.WaitingTimeSeconds
metric. For the latter metric, 60+% of all observations are at the 5
second mark and 98% of all observations being within 30 minutes and
the max observation is roughly one hour.

Since this can only happen when the p2p-client process is handling the
SIGTERM signal and update_engine never sends it, one guess is that it
happens when the system is shutting down and the init system sends
SIGTERM to all processes (and then SIGKILL after a while if they're
still around).

This hypothesis however does not directly explain the spike at the 5
second mark, nor the distrbution. However another bug in p2p-client
namely that we report monotonic time, not wall-clock time, might
explain this. See CL:182700 for further information.

BUG=None
TEST=New unit test + Unit tests pass.

Change-Id: I29ff16c5434ab68cb9a5a314f29f5154982fe0e1
Reviewed-on: https://chromium-review.googlesource.com/182710
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: David Zeuthen <zeuthen@chromium.org>
Tested-by: David Zeuthen <zeuthen@chromium.org>
/system/update_engine/omaha_request_action_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/omaha_request_action_unittest.cc
d04f8e24716d5acca6a7d116b63851adc1506845 09-Jan-2014 Gilad Arnold <garnold@chromium.org> AU: prepend TMPDIR when creating a temp file/directory

This changes the behavior of utils::MakeTemp{File,Directory} to prepend
TMPDIR (or /tmp, if not defined) to the given path template. That is,
unless the user provided an absolute path, or a path that is explicitly
relative to the current directory (starts with ./ or ../).

BUG=chromium:253622
TEST=None

Change-Id: Ibe11b279f8f4e9ba97bb2d44867595f76bbf632a
Reviewed-on: https://chromium-review.googlesource.com/182098
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/omaha_request_action_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/omaha_request_action_unittest.cc
968d057f7a37bc981e2a732fb07521cfc8dcb16a 23-Aug-2013 Chris Sosa <sosa@chromium.org> Never defer updates on interactive checks.

Looks like we had a bug when adding the deferred logic. We should never
defer on interactive checks as it's really confusing to a user who's
doing an interactive check. This change is simple enough but I've changed
all unittests that tested deferred behavior to also make sure they allow
an update if interactive is set.

BUG=chromium:274056
TEST=Unittests

Change-Id: Ib63dbd20e64bed2da84e68c96291335e00e944a2
Reviewed-on: https://gerrit.chromium.org/gerrit/66864
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
/system/update_engine/omaha_request_action_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/omaha_request_action_unittest.cc
3b74843840fda8e6954986bdd6a9fccc835d5580 21-Jun-2013 Chris Sosa <sosa@chromium.org> Parse and add manifest version to the Omaha Response object.

This CL adds the version of the update we're updating to to the Omaha
response object and removes the use of DisplayVersion. DisplayVersion is
from the Omaha Protocol v1, and v2 and has never been used or relied
upon in the update engine.

Protocol is described here:
https://code.google.com/p/omaha/wiki/ServerProtocol

Manifest version should always describe the version of the application we are
updating to as is described by the manifest.

BUG=chromium:252527
TEST=Unittests + devserver image_to_live test.

Change-Id: I9afaa8af3c21813f19d88abf437f35b024d31985
Reviewed-on: https://gerrit.chromium.org/gerrit/59498
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
c1972483fa3446852b42ce97d1ea43b9caaaf56f 01-May-2013 Chris Sosa <sosa@chromium.org> Add EC and Firmware Versions to the Omaha Response.

This CL adds 2 additional utils methods to get the version for both the
fw and ec versions. I've added a unittest to verify these work and piped
in the values into the omaha response.

BUG=chromium:219871
TEST=Unittests + on device

Change-Id: Iadf70fff858988f52797d94bcdb062bb2482bbf3
Reviewed-on: https://gerrit.chromium.org/gerrit/49713
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
Tested-by: Chris Sosa <sosa@chromium.org>
/system/update_engine/omaha_request_action_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/omaha_request_action_unittest.cc
be45bef9e283188b00e7def8967f81843669a7f1 10-Apr-2013 Chris Sosa <sosa@chromium.org> Add update reboot metric to the update engine.

This change add the Installer.UpdateNumReboots metric.

This records the number of reboots that occurred while an update was being
attempted. It uses a marker file stored in tmp to discover whether or not
it's already recorded the reboot.

BUG=chromium:226766
TEST=Unittests | ran an update on a test machine and rebooted/resumed and
checked about:histograms to confirm numbers. Also restart update-engine to
verify it didn't double count that.

Change-Id: I5d2af9d5b62a9d974c7c6243a89cb3359051b650
Reviewed-on: https://gerrit.chromium.org/gerrit/47710
Tested-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Chris Sosa <sosa@chromium.org>
Reviewed-by: Chris Sosa <sosa@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
42bd3aaadbafda71e63c8a4d6cd6561a3bcde928 11-Apr-2013 Don Garrett <dgarrett@google.com> Remove the obsolete needsadmin attribute.

It seems that the needsadmin attribute hasn't been used for a long time, so
stop parsing it. We were parsing out the value, then ignoring it anyway.

BUG=chromium:199039
TEST=built, trybot mario-release

Change-Id: Ic0fbb8924af7c647fe1630cc60c260587431a0ff
Reviewed-on: https://gerrit.chromium.org/gerrit/47822
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Don Garrett <dgarrett@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Queue: Don Garrett <dgarrett@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
d29695df35b7192faef4009d42a62c37bdd90a8f 09-Apr-2013 Jay Srinivasan <jaysri@chromium.org> Refactoring: Move prefs constants out to the constants.h/cc

Adding/removing the set of keys used by various parts of the Update Engine code
does not affect the implementation of the prefs module, hence separating them.

BUG=chromium:229090
TEST=Unit tests pass.

Change-Id: Id774b726a47b461e563e2e413527054e4da0c012
Reviewed-on: https://gerrit.chromium.org/gerrit/47593
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/omaha_request_action_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/omaha_request_action_unittest.cc
8a659d80dc1912c664ef16f0bc66acaa01bd8b73 24-Jan-2013 Gilad Arnold <garnold@chromium.org> AU: change 'userinitiated' into 'installsource'

- Renamed the flag so it is in line with the flag name and values used
by Chrome to indicate different forms of an update. It will allow us
to reuse existing Omaha dashboard facilities to monitor this flag.

- Also, per advise from Omaha, moved the said attribute to the <request>
XML node.

BUG=chromium-os:26594
TEST=New flag name/values now appear

Change-Id: I46a158b3aef8a56813464d74fc6043ea5b1ec3c1
Reviewed-on: https://gerrit.chromium.org/gerrit/41951
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
5e73ad739d514a1186a1fbbbc28e3de33dade9cf 18-Jan-2013 Gilad Arnold <garnold@chromium.org> AU: move 'userinitiated' flag to the right place in an update check

The said flag, introduced in a recent change, should be an attribute of
the <updatecheck> node, now fixed. Also changed a couple of unit tests
to reflect this.

BUG=chromium-os:26594
TEST=Flag now appears in the right place

Change-Id: I4f024797da34376364d358631d1a606be8be639e
Reviewed-on: https://gerrit.chromium.org/gerrit/41628
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
bbdd4909bcd20448ad89aa1e02c936e42aedf548 11-Jan-2013 Gilad Arnold <garnold@chromium.org> AU: add an interactive flag to Omaha requests

Such a flag can be used to distinguish between user-initiated
(interactive) checks and those that are due to background scheduling. In
the former case, we may want to suppress the probabilistic throttling
that's commonly used with latest releases. This CL piggybacks the new
functionality on top of an existing dataflow used for distinguishing
between interactive / scheduled checks, only it pushes it further so it
is evident in the Omaha request as well.

Comes with a unit test for ensuring that the Omaha flag is set as
expected.

BUG=chromium-os:26594
TEST=Dbus initiated checks correctly tainted

Change-Id: Ia2b3ff5ce3a866c64e453557028b8cbd92c1a258
Reviewed-on: https://gerrit.chromium.org/gerrit/41081
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
d671e97c8cc87c71a01ee3e4a889753ea9bec35f 12-Jan-2013 Jay Srinivasan <jaysri@chromium.org> Use IsDeltaPayload instead of IsDelta.

Trying to resurrect the IsDelta in an earlier CL to avoid pollution of
Omaha rules turned out to be a wrong choice because R14 and R15 code
strictly expects IsDelta to be true even for full payloads. So
preserving IsDelta's semantics as-is and introducing IsDeltaPayload to
really convey the intended semantics: True if it's delta payload, False
if it's full payload.

BUG=chromium-os:37801
TEST=Updated unit tests. Works fine on ZGB with Omaha devserver.

Change-Id: I899b56be4dcbdcf1981f72d356d40a1e99fdf725
Reviewed-on: https://gerrit.chromium.org/gerrit/41181
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/omaha_request_action_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/omaha_request_action_unittest.cc
23b92a52e8781d68c451d6cd5e67aab1e5f82264 27-Oct-2012 Jay Srinivasan <jaysri@chromium.org> Upgrade update_engine from Omaha v2 to v3 protocol.

Omaha had released the v3 protocol long back, but update_engine kept
using the v2 protocol as there was no immediate need to move. But now
that we need to support HTTP-based downloads, we need to supply multiple
URLs for each rule, one for HTTP, one for HTTPS fallback. Even for
HTTPs, it is also useful for scenarios such as specifying a Google
storage URL as the primary download point and keeping Lorry as a backup
URL. Multiple URL support is available only on Omaha v3 protocol.

So, this CL is to first upgrade of the client protocol from v2 to v3. It
does not add any new functionality and still supports only one URL. The
subsequent checkins will take advantage of the multiple URL support.

This CL also includes a sample xml file which illustrates how the new
response from the Omaha v3 server would look like, which should greatly
help in understand the changes.

As part of this change, I've also consolidated a few error codes which
had practically zero occurrence into one error code and reused those
error codes for the recently added errors (which haven't been shipped
anywhere yet). Since we're now publishing all the error codes in UMA, we
need to be conservative in defining distinct error codes in order to
reduce the memory usage of Chrome for UMA stats.

BUG=chromium-os:6594
TEST=Tested on ZGB with Omaha v3 server. Updated unit tests and they pass.
Change-Id: I187aa0500e39623684130ba9e3d1d948c0e60627
Reviewed-on: https://gerrit.chromium.org/gerrit/36758
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
Commit-Ready: Chris Sosa <sosa@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
34b5d86d057d450325dd06d35ae182ac6da306e4 23-Jul-2012 Jay Srinivasan <jaysri@chromium.org> Use a local UpdateFirstSeenAt timestamp instead of UpdatePublishedOn

The existing implementation that used the UpdatePublishedOn doesn't work
well with other AU enterprise policies such as stop AU, target version,
etc. This change will help all those scenarios to work and will make
the co-existence of policies more intuitive for the enterprise admin.

Basically, these scenarios bring out a flaw in the assumption I had
made earlier. i.e. we had assumed that if an update was pushed 5 months
ago, we never have to scatter that because most machines would have
been picked up the update by then. With the other AU policies like
stop AU or version pinning, this assumption is not true and scattering
is still relevant in these cases.

This new UpdateFirstSeenAt timestamp is the first time a Chrome device
hears of an update from Omaha that's eligble to be applied to the device
based on all policies except scattering. It'll use this timestamp instead
of the UpdatePublishedOn from the rule (which is no longer needed) and
everything else remains the same. This UpdateFirstSeenAt value will
also be persisted so that the waiting period can be satisfied over reboots
when an update is not ready to be applied yet.

This timestamp will be cleared (only) after an update has been successfully
applied and the device is waiting to be rebooted.

Also contains a minor fix for avoiding the crash mentioned in 32797.

BUG=chromium-os:32280
TEST=Added new unit tests, tested on ZGB.
Change-Id: I1d7845a11f7eb7fc0a019018c8c4b9a3c68ee2cd
Reviewed-on: https://gerrit.chromium.org/gerrit/28100
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/omaha_request_action_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/omaha_request_action_unittest.cc
8155d081dc729d407f8ff9e95b4ef91ae14281ce 06-Apr-2012 Mike Frysinger <vapier@chromium.org> pull in base/stringprintf.h explicitly

Newer libbase no longer implicitly includes the stringprintf.h header,
so building against it fails with missing StringPrintf definitions.

BUG=chromium-os:25872
TEST=`emerge-x86-alex update_engine` works with old & new libbase

Change-Id: Ia1ea842449c0382ee4c8e5abd3ddfb3012c3ff2f
Reviewed-on: https://gerrit.chromium.org/gerrit/19774
Commit-Ready: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
56d5aa471205bf2271219252ec94b5f0c986a68b 26-Mar-2012 Jay Srinivasan <jaysri@chromium.org> Report usage of StopAutoUpdate policy in borgmon charts

Omaha already has an event result for reporting UpdateDeferred (9)
which shows up in the borgman charts. In order to use that we should
perform a normal updatecheck without the updatedisabled set to true and
then discard the response with event type UpdateComplete (3) but with
event result UpdateDeferred (9).

BUG=28645: Report StopAutoUpdate enforcement in Borgmon charts for Omaha
TEST=Tested success, error and deferred cases on my zgb.
Change-Id: I27cb4465ea9876b39edaff3b747ada44a4f875d4
Reviewed-on: https://gerrit.chromium.org/gerrit/19112
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/omaha_request_action_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/omaha_request_action_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/omaha_request_action_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/omaha_request_action_unittest.cc
b44e9e8fcfdac6432ba45867fce0ec8557860734 06-Jun-2011 Thieu Le <thieule@chromium.org> Change code to ignore ping Omaha requests that are empty

BUG=chromium-os:15498
TEST=Unit tests, manually applied update and ensure we are ignoring
empty pings

Change-Id: I49223098a3dbc0b12504f3561c9feb1a02a1dbe3
Reviewed-on: http://gerrit.chromium.org/gerrit/2184
Tested-by: Thieu Le <thieule@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
265f290d2be0a68b6266d5962f7c23290c0ced5f 10-May-2011 Darin Petkov <petkov@chromium.org> AU: Don't include the previous version event in ping-only requests.

Ping-only requests are issued after an update is applied but before the device
is rebooted. The previous version event needs to be sent once after reboot
(following a successful AU).

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

Change-Id: I6fddd4a0a49dedd7af6730f5b7f3417079b93223
Reviewed-on: http://gerrit.chromium.org/gerrit/561
Tested-by: Darin Petkov <petkov@chromium.org>
Reviewed-by: Thieu Le <thieule@chromium.org>
/system/update_engine/omaha_request_action_unittest.cc
c1d5c93ddf56e193fd501e5f8fc3fc45efdc560f 21-Apr-2011 Andrew de los Reyes <adlr@chromium.org> AU: Handle firmware update failure when booted from FW slot B.

The firmware updater will fail if we are booted into FW slot B and we
try to update firmware. We shouldn't treat this like a usual update
failure because trying again won't help until we reboot. Thus, with
this CL, we detect this case and request a reboot from the
user. Technically this request is a lie, b/c we are reusing the reboot
request mechanism which tells the user an update has been applied and
thus must be rebooted. We accept this fib since this situation is very
rare: use would have to have 2 FW update updates in a row w/o any
extra boots between.

Also, fix error code in subprocess.

Also, remove execute permissions on a bunch of source files.

BUG=chromium-os:14343
TEST=unittests, tested updates on machine that success, fail, have FW B failure

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

Change-Id: I2509c6e1c9c9da3ff1ea27da4861c4850bd4d000
/system/update_engine/omaha_request_action_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/omaha_request_action_unittest.cc
173e63c7e21ea7a6fdda0509c6184d79e146e4c3 05-Apr-2011 Andrew de los Reyes <adlr@chromium.org> AU: OmahaRequestAction: allow to be skipped.

This CL changes OmahaRequestAction to take a request to skip its
action when it's run. This will be useful in a future CL, where we'll
want to schedule an OmahaRequestAction to run, but then in some cases
prevent it from actually doing so.

This also changes MockHttpFetcher to be able, if properly configured,
to fail it it's used. This is used in the test to make sure that a
skipped OmahaRequestAction does no HTTP traffic.

BUG=chromium-os:13813
TEST=unittests

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

Change-Id: Ic3e4099d221c4d7d0bca65b1a0064c33dca4edb5
/system/update_engine/omaha_request_action_unittest.cc
44d98d9e964a7be0f440ed8104bbcb8d1b23a4bb 22-Mar-2011 Darin Petkov <petkov@chromium.org> Use crossystem rather than cros_boot_mode.

Also, make the check for normal mode a bit more restrictive.

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

Change-Id: I3ec8a4c5526208d6f050ec2e152604b2ead76f27

Review URL: http://codereview.chromium.org/6719012
/system/update_engine/omaha_request_action_unittest.cc
5c0f36e448976993bf68125450ffa42946eed618 13-Jan-2011 Darin Petkov <petkov@chromium.org> AU: XmlEncode the previous version, just in case.

BUG=9198
TEST=unit tests

Change-Id: I5ae497fa4c318645ac07ee6fcef6dad9b276606f

Review URL: http://codereview.chromium.org/6253002
/system/update_engine/omaha_request_action_unittest.cc
c91dd6ba9bca68cdd086468233c999b53d204059 10-Jan-2011 Darin Petkov <petkov@chromium.org> AU: Include a bit flag (bit 31) in error codes to indicate non-normal boot mode.

BUG=chromium-os:10320
TEST=unit test, tested on device in normal and dev mode

Change-Id: I67d695bc167a4cc1a638711f047e2b86f8eaa8f1

Review URL: http://codereview.chromium.org/6098008
/system/update_engine/omaha_request_action_unittest.cc
95508da905b279a6b91aadfc7c4c72f57a5fa610 05-Jan-2011 Darin Petkov <petkov@chromium.org> AU: Send a previous version event after reboot following an update.

The previous version event is sent along with the first update check. This is
best effort -- if the update check doesn't reach the server, the event is lost.

BUG=9198
TEST=unit tests, tested on device

Change-Id: I5ceb7c8e99ae54eb331f6ac58b8977d2a111461c

Review URL: http://codereview.chromium.org/5993007
/system/update_engine/omaha_request_action_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/omaha_request_action_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/omaha_request_action_unittest.cc
edc522e7e5c0c14c3f8a55fd2a0d23d8a6032917 05-Nov-2010 Darin Petkov <petkov@chromium.org> AU: Separate error codes for different OmahaRequestAction failures.

BUG=8651
TEST=unit tests, tested an update on the device through dev server

Change-Id: Ic590906be269fe371702bfbe282cddc197ab01fc

Review URL: http://codereview.chromium.org/4432002
/system/update_engine/omaha_request_action_unittest.cc
6c11864907e9a92f8069c77c08650102e0b34e0d 21-Oct-2010 Darin Petkov <petkov@chromium.org> AU: propagate a deadline form the update check response to Chrome.

Currently, this is done through the file system.

BUG=3284
TEST=unit tests

Change-Id: I0e579ef6ccd7832ca22a248e71f2689c27159056

TBR=resubmitting due to git issues
/system/update_engine/omaha_request_action_unittest.cc
d22cb29c911375cda5d8eb783e78a46680404ca8 29-Sep-2010 Darin Petkov <petkov@chromium.org> AU: Switch from SHA-1 to SHA-256 hash.

For hashing of images, expect a new "sha256" attribute in Omaha's updatecheck
response.

BUG=6580
TEST=unit tests, gmerged on device and updated with upgraded dev server

Change-Id: I122e21cd7edc74695cb81b2eee5ce70f152f5270

Review URL: http://codereview.chromium.org/3419018
/system/update_engine/omaha_request_action_unittest.cc
fbb40098314ab45efa60667ad7ccae354c4f18da 30-Jul-2010 Darin Petkov <petkov@chromium.org> Add a hardware_class attribute (for HWID, HWQual ID) to the Omaha request.

BUG=1600
TEST=unit tests, gmerge and looked at request logs

Review URL: http://codereview.chromium.org/3007020
/system/update_engine/omaha_request_action_unittest.cc
84c763cffce6778711792944387fadb760c55c8d 30-Jul-2010 Darin Petkov <petkov@chromium.org> AU: Remove instances of Omaha ID -- machine ID and user ID.

Also add a unit test to make sure we are not sending machineid or userid
attributes.

BUG=1439
TEST=unit tests, gmerged on device, checked for update, looked at logs

Review URL: http://codereview.chromium.org/2808082
/system/update_engine/omaha_request_action_unittest.cc
1cbd78ffe68039a5781c3434816e03e64033dc0b 29-Jul-2010 Darin Petkov <petkov@chromium.org> Don't send machine and user ID to Omaha anymore. Send a/r pings instead.

This avoids sending a unique ID in order to track active user counts.
Note that this CL doesn't remove the machine/user/Omaha ID/file from
the params object -- it just makes them unused/obsolete. Removal will
be done in a subsequent CL in an effort to make this CL smaller.

BUG=1439
TEST=unit tests, x86-generic, arm-generic, gmerged and inspected logs

Review URL: http://codereview.chromium.org/2856070
/system/update_engine/omaha_request_action_unittest.cc
e17f86bae4299882232d3e6858ada68692e80501 20-Jul-2010 Darin Petkov <petkov@chromium.org> Switch OmahaEvent's error_code to ActionExitCode.

Also, emit the errorcode attribute only for non-success events.
Added explicit unit tests for OmahaEvent.

BUG=560
TEST=unit tests, gmerged on device, forced update, looked at logs.

Review URL: http://codereview.chromium.org/3035007
/system/update_engine/omaha_request_action_unittest.cc
c1a8b426be9542bc880923711ca508ea3f84000e 19-Jul-2010 Darin Petkov <petkov@chromium.org> For actions, switch bool success into an exit code.

This way we can signal specific error conditions and then
send appropriate events to Omaha from the UpdateAttempter.

BUG=560
TEST=unit tests, gmerged and looked at logs

Review URL: http://codereview.chromium.org/3022008
/system/update_engine/omaha_request_action_unittest.cc
3f0303aa211e2de2d466cef063ff6f39fffe32dd 16-Jul-2010 Andrew de los Reyes <adlr@chromium.org> AU: pass whether or not we can tolerate a delta to the server

BUG=4848
TEST=attached unittests

Review URL: http://codereview.chromium.org/3017006
/system/update_engine/omaha_request_action_unittest.cc
3270f7411f55b872db385d0edffdfed18a684121 16-Jul-2010 Andrew de los Reyes <adlr@chromium.org> AU: Changes for deltas on traditional bios machines.

BUG=None
TEST=Attached unittests/tested on image

- Fix uninitialized variable err in action processor unittest

- Let Omaha dictate if an update is a delta or full update

- Bug fix in delta generator for differently-sized images

- More logging when applying delta updates

- Fix infinite loop in http fetcher unittest

- log each HTTP connection to know when a dropped connection is
reestablished.

- Detect when speed goes below a threshold and reestablish HTTP
connection (currently < 10bytes/sec for 90 contiguous seconds).

- Fix stack overflow in libcurl http fetcher.

- optimize out a lot of needless CPU usage in libcurl http fetcher
(turns out adding a glib main loop source uses a lot of CPU).

- subprocess: pass PATH, log stdout/stderr

- postinstall runner: support for ext3 and ext4 target filesystems.

Review URL: http://codereview.chromium.org/2805027
/system/update_engine/omaha_request_action_unittest.cc
a4a8a8ccc2d9e0285728ed247b43f09433e63323 16-Jul-2010 Darin Petkov <petkov@chromium.org> Turn OmahaRequestPrepAction into OmahaRequestDeviceParams.

Pass the params to OmahaRequestAction's ctor. This simplifies a bit
executing as well as testing of OmahaRequestAction and testing of
OmahaRequestDeviceParams. It also allows us to initialize the params
once per update attempt and use them for all OmahaRequestActions.

BUG=560
TEST=unit tests, gmerged on device and forced an update through dev server,
inspected logs.

Review URL: http://codereview.chromium.org/2836053
/system/update_engine/omaha_request_action_unittest.cc
0dc8e9a73fc3179a67a72ab72ceb2bc6540949bf 14-Jul-2010 Darin Petkov <petkov@chromium.org> Initial implementation of sending an install success event to Omaha.

BUG=560
TEST=emerged,ran unit tests

Review URL: http://codereview.chromium.org/2981008
/system/update_engine/omaha_request_action_unittest.cc
6a5b3229b44c1f81ee153829e9b501e547f29926 13-Jul-2010 Darin Petkov <petkov@chromium.org> Rename UpdateCheckAction|Params to OmahaRequestAction|Params.

Also, renamed UpdateCheckResponse to OmahaResponse.

BUG=560
TEST=unit tests, gmerge'd on device.

Review URL: http://codereview.chromium.org/2981007
/system/update_engine/omaha_request_action_unittest.cc