History log of /system/update_engine/test_http_server.cc
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6f10c5f7c550b1bd6df1d9a04b5e75e03f943639 04-Mar-2016 Alex Deymo <deymo@google.com> Parse and use extra HTTP headers when downloading the payload.

Android OTA backend requires to pass an Authorization HTTP header in
order to download some payload. This patch allows to specify such
header when initiating a payload download from Android.

Bug: 27047110
TEST=Added unittests to check the headers sent.

(cherry picked from commit fdd6dec9c4be2fbd667cf874c4cc6f4ffecaeef9)

Change-Id: I59d38d79a7b7a8975d105c611c692522b6c33707
/system/update_engine/test_http_server.cc
a3cf75a1d01aeb03d2341600ebff3db0a8316200 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.

(cherry picked from commit 0103c36caa2e38e034e0d22185736b9ccfb35c58)

Change-Id: I3dedd8b3f6e92ce8d3eeef99a76ad876c29db304
/system/update_engine/test_http_server.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/test_http_server.cc
f123ae2065ef19c172ae67a4c11cf23f1b787204 24-Sep-2015 Alex Deymo <deymo@google.com> Remove leaked callback when CleanUp() from TimeoutCallback().

When CleanUp() is called indirectly from TimeoutCallback(), the
TimeoutCallback() itself is canceled before the new recurrent call is
scheduled. The CancelTask() call will trivially succeed because the
callback already triggered.

Before CL:281197, the g_source_destroy() call to remove the currently
running callback would prevent it from being re-scheduled even if it
returns TRUE from the callback.

This patch re-schedules the callback before calling CurlPerformOnce()
so CancelTask() would cancel the scheduled task.

Bug: chromium:535649
Test: Added unittest. Verified it fails without the change.

Change-Id: Ica742dab0eb8d9d5c5055c8afac9d775ad1e0012
/system/update_engine/test_http_server.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/test_http_server.cc
6a9d3497bcf57b8b9f5765a2909a51c9f8119cd1 15-Jun-2015 Alex Vakulenko <avakulenko@chromium.org> platform2: Fix issues with new version of libchrome

libchrome r334380 has the following breaking changes that need to be fixed:
- base::JSONWriter::Write() and base::JSONWriter::WriteWithOptions() take
"const base::Value&" instead of "const base::Value*"
- base::JSONReader::Read() and base::JSONReader::ReadAndReturnError()
return a scoped_ptr<base::Value> instead of base::Value*
- base/safe_strerror_posix.h is moved to base/posix/safe_strerror.h
- safe_strerror() is now in "base" namespace
- StartsWithASCII(), EndsWith(), StringToUpperASCII(), LowerCaseEqualsASCII()
are now in "base" namespace
- ObserverList<T> is now in "base" namespace
- base::PrintTo(base::FilePath) used in gtest is now moved to libchrome-test
library and as such, unit test runners need to link to this library now.
- crypto::RSAPrivateKey::CreateSensitive() is now removed from //crypto, so
some of tests in chromeos-login that used that function had to be changed
to use crypto::GenerateRSAKeyPairNSS() directly.
- UnixDomanSocket class is now in "base" namespace
- Pickle class is now in "base" namespace

BUG=chromium:496469
TEST=`./build_packages`
CQ-DEPEND=CL:277662

Change-Id: I36e5fbf2e36a92068873ffbd44020c862a3ed9e3
Reviewed-on: https://chromium-review.googlesource.com/277671
Reviewed-by: Alex Vakulenko <avakulenko@chromium.org>
Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
Trybot-Ready: Alex Vakulenko <avakulenko@chromium.org>
Tested-by: Alex Vakulenko <avakulenko@chromium.org>
/system/update_engine/test_http_server.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/test_http_server.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/test_http_server.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/test_http_server.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/test_http_server.cc
b6c562adec6e9491712f156f8fd50e2b807ff302 01-Jul-2013 Gilad Arnold <garnold@chromium.org> AU/unittest: test code spawns local HTTP server with unique port

With this change, unit testing code spawns a local (test) HTTP server
that listens on a unique TCP port. It is up to the server to allocate an
available port number (we use auto-allocation via bind) and report it
back (by default, via its stdout), which the unit test process parses.
Also part of this CL:

- Made the port a property of the server object, rather than a global
value. This makes more sense in general and may lend itself better to
future testing scenarios, such as running multiple servers in
parallel.

- Removed a redundant field (validate_quit) from PythonHttpServer and
simplified/robustified its shutdown procedure: if the server is known
to be responsive, a graceful signal is sent (via wget); otherwise, or
if the former failed, a more brutral signal(SIGKILL) is used.

- http_fetcher_unittest code now properly kills test_http_server if the
latter is unresponsive.

BUG=chromium:236465
TEST=Test server spawned with unique port

Change-Id: I699cd5019e4bd860f38205d84e5403cfb9b39f81
Reviewed-on: https://gerrit.chromium.org/gerrit/60637
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/test_http_server.cc
97bdb3f6b2288e2fda623fdcbafd2cb3a9e7539a 01-Jul-2013 Gilad Arnold <garnold@chromium.org> AU/unittest: parameterize test_http_server port

This eliminates the constant definition of the test HTTP server port,
replacing it with a command-line parameter (which defaults to 8080, the
well-known userland HTTP port). This is needed for allowing parallel
invocations of unit tests.

BUG=chromium:236465
TEST=Passes unit tests

Change-Id: I91904dc360ec1b993cbaae93554fb0dd9e5adaad
Reviewed-on: https://gerrit.chromium.org/gerrit/60626
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
/system/update_engine/test_http_server.cc
135a58b2cc8bd94c384625d375f0bf26252d6f07 13-Jul-2012 Jay Srinivasan <jaysri@chromium.org> Fixed incorrect test cleanup that causes update_engine unit tests to hang

The PythonHttpServer class has to be cleaned up always. This was not
happening properly in one test (ServerDiesTest). This was causing the
succeeding test (which always happened to be SimpleRedirectTest) to use the
wrong server sometimes or hang forever.

Adding a bunch of instrumentation in unit test code helped to figure out
what's going, so leaving them in.

BUG=chromium-os:32096
TEST=update engine unit tests run fine.
Change-Id: Ide9a31eb411c8687ca39d78d8ebff97fe6305dbe
Reviewed-on: https://gerrit.chromium.org/gerrit/27325
Commit-Ready: Jay Srinivasan <jaysri@chromium.org>
Reviewed-by: Jay Srinivasan <jaysri@chromium.org>
Tested-by: Jay Srinivasan <jaysri@chromium.org>
/system/update_engine/test_http_server.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/test_http_server.cc
0f9547d10fc3df51c8dd3828a495e89ed0260037 16-Feb-2012 Mike Frysinger <vapier@chromium.org> fix build warnings with type mismatches and base check helpers

Building with base headers in a SLOT-ed setup exposes build warnings
(which causes failures due to -Werror). One such example:

In file included from extent_writer.h:9:0,
from bzip_extent_writer.h:10,
from bzip_extent_writer.cc:5:
.../base/logging.h: In function 'std::string* logging::CheckEQImpl(const t1&, const t2&, const char*)
[with t1 = unsigned int, t2 = int, std::string = std::basic_string<char>]':
bzip_extent_writer.cc:53:7: instantiated from here
.../base/logging.h:512:1: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
cc1plus: all warnings being treated as errors

Explicitly cast the constants to avoid these.

BUG=chromium-os:16623
TEST=`emerge-x86-alex update_engine` builds

Change-Id: If3cc4e85fa54862b14305f9d045c73b5575efaa0
Reviewed-on: https://gerrit.chromium.org/gerrit/16035
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Ready: Mike Frysinger <vapier@chromium.org>
/system/update_engine/test_http_server.cc
e4ad2508de4d69d7a90d3ce441efe2c82c55bd1d 30-Dec-2011 Gilad Arnold <garnold@chromium.org> AU multi-range fetcher requests properly closed ranges when their length
is known.

* HttpFetcher allows to set the length of data to be fetched.
LibcurlHttpFetcher uses this value in applying the appropriate libcurl
option (CURLOPT_RANGE). MultiHttpFetcher sets the desired payload
length in the underlying fetcher accordingly.

* Improved functionality of test_http_server: (a) correctly parses
closed range intervals; (b) generalized response header generation;
(c) unified and generalized get handling for both stable and flaky
cases.

* Small scale refactoring, improved logging and readability.

BUG=chromium-os:24666
TEST=unit tests

Change-Id: I1727710ca747088c67a68305f355da683b07b6a3
Reviewed-on: https://gerrit.chromium.org/gerrit/13594
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
/system/update_engine/test_http_server.cc
9bedeb51f80c9547269eef6c2ec09596033bb818 18-Nov-2011 Gilad Arnold <garnold@chromium.org> Fetcher tries all proxies when a secondary chunk download error occurs.

This is a fix to issue 18143:

* New test cases for asserting the desired behavior: if a transfer of
a secondary chunk within a multi-chunk fetch fails, then the fetcher
needs to retry with other available proxies; it will only fail when no
additional proxies are available. The tests ensure both success (one
of the proxies eventually succeeds) and failure (all proxies fail)
cases.

* Small fix to LibcurlHttpFetcher to retry with other proxies upon
failure (error value) of a secondary chunk.

Other changes applied in the course of this fix:

* Massive refactoring of http_fetcher_unittest: substituted template
specialization in typed test setup with proper subclassing, resulting
in a safer and more maintainable infrastructure; extended URLs to
include all (most) parameters pertaining to test workload, such as
download size, flakiness, etc.

* Respective changes to test_http_server: it is now much more
independent of particular kind of tests, and more easily
parametrizable. Also, generalized several internal methods for better
readability and extensibility, such as writing of arbitrary payloads,
parsing headers,

* Migrated common definitions into http_common.{h,cc} (universal
HTTP-related stuff) and http_fetcher_unittest.h (shared definitions
pertaining to unit tests).

* Extended direct proxy resolver to generate a list of (non-) proxies,
so we can unit test proxy failure. Also, better logging to improve
testability.

* Some renaming of classes for better consistency.

BUG=chromium-os:18143
TEST=unit tests

Change-Id: Ib90b53394d7e47184d9953df8fc80348921e8af0
Reviewed-on: https://gerrit.chromium.org/gerrit/12092
Commit-Ready: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Gilad Arnold <garnold@chromium.org>
Tested-by: Gilad Arnold <garnold@chromium.org>
/system/update_engine/test_http_server.cc
48085ba58516e94f045d3ab7e26c8f36e6a6936f 16-Nov-2011 Gilad Arnold <garnold@google.com> Updater avoids download in case of an error HTTP response.

(a) LibcurlHttpFetcher avoids download if the HTTP reponse indicates an
error; corresponding change to unit test code and test HTTP server. (b)
Added a method for returning the total bytes downloaded to HttpFetcher
and all subclasses, needed for unit testing. (c) Generalized check for
successful HTTP response code in LibcurlHttpFetcher.

BUG=chromium-os:9648
TEST=unit tests

Change-Id: I46d72fbde0ecfb53823b0705ce17f9547515ee61
Reviewed-on: https://gerrit.chromium.org/gerrit/11773
Tested-by: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Andrew de los Reyes <adlr@chromium.org>
Commit-Ready: Gilad Arnold <garnold@chromium.org>
/system/update_engine/test_http_server.cc
f67bb1f187d7fcea38a33badf4bc619fc2e5c0fc 09-Nov-2010 Darin Petkov <petkov@chromium.org> AU: Change test http server port from 8080 to 8088.

This allows developers to run unit tests while the dev server is running. Also
remove obsole test_http_server.py.

BUG=8889
TEST=unit tests while dev server is running.

Change-Id: Iaf0ff92edbb959d93bd206c0007455f637682e2c

Review URL: http://codereview.chromium.org/4667002
/system/update_engine/test_http_server.cc
3fd5d30433509859bfdcc0b650e242981410c6a7 08-Oct-2010 Andrew de los Reyes <adlr@chromium.org> AU: MultiHttpFetcher, an HttpFetcher for specific byte ranges

MultiHttpFetcher takes an HttpFetcher class via template parameter,
and a collection of byte ranges. It hits up the URL multiple times,
once per range specified. For each time, it uses a new HttpFetcher of
the type specified and fast-forwards to the offset requested, and
aborting after enough bytes have been downloaded. Any range many
specify a length of -1, which means until the end of the file (as
dictated by the server). Thus, a single range of [0, -1] makes
MultiHttpFetcher a pass-through.

HttpFetcher change: ability to supply an offset.

LibcurlHttpFetcher changes: offset support (from HttpFetcher API),
ability to be terminted in a write-callback.

test_http_fetcher: support for failures in write() on the socket (at
least in the /big url case).

BUG=7391
TEST=unittests

Review URL: http://codereview.chromium.org/3591018
/system/update_engine/test_http_server.cc
41c2fcf4525a3b4e8960c4b71dfe4f4f11c8224f 25-Aug-2010 Darin Petkov <petkov@chromium.org> AU: Support redirects.

BUG=5692
TEST=unit tests, gmerged on device, making sure update engine still works

Change-Id: If593f6efbd39452aa98b453f4d5489ce7d7d7fb9

Review URL: http://codereview.chromium.org/3161041
/system/update_engine/test_http_server.cc
790e62e2d8114647b0785574bea361cf931c482b 12-Aug-2010 Chris Masone <cmasone@chromium.org> [update_engine] Update to use not-hideously-old logging API from chrome

BUG=None
TEST=compile

Change-Id: Ieed8952b6806a72b59e16c1579f7293b6a98157a

Review URL: http://codereview.chromium.org/3170010
/system/update_engine/test_http_server.cc
fb4ad7d5e8c5946fc475f3ee289b38287f015326 19-Jul-2010 Andrew de los Reyes <adlr@chromium.org> AU: HTTP success is not just 200, but anything in the 2xx range

BUG=None
TEST=attached unittest

Review URL: http://codereview.chromium.org/3036005
/system/update_engine/test_http_server.cc
08c4e27baaa7b40732b99642e1f21bf889d022ef 15-Apr-2010 Andrew de los Reyes <adlr@chromium.org> update engine: 32- and 64-bit compile

Review URL: http://codereview.chromium.org/1599029
/system/update_engine/test_http_server.cc
3defe6acb3609e70e851a6eff062577d25a2af9d 04-Dec-2009 adlr@google.com <adlr@google.com@06c00378-0e64-4dae-be16-12b19f9950a1> Missed new files in last commit

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


git-svn-id: svn://chrome-svn/chromeos/trunk@336 06c00378-0e64-4dae-be16-12b19f9950a1
/system/update_engine/test_http_server.cc