Fix StackOverFlow in AdvancedMockContext.
commitdb1ff46b8bc4aab32471fd26252220824aa9c94e
authornyquist@chromium.org <nyquist@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Fri, 18 Jul 2014 07:12:52 +0000 (18 07:12 +0000)
committernyquist@chromium.org <nyquist@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Fri, 18 Jul 2014 07:12:52 +0000 (18 07:12 +0000)
tree2de55f5f9d54b1ffe0370c326d72879d0b95f3e6
parent8a14e2a355e47b8259262dc916c85a5661396b6b
Fix StackOverFlow in AdvancedMockContext.

The AdvancedMockContext previously did not override registerComponentCallbacks
and unregisterComponentCallbacks. The implementation of these methods in
Context calls getApplicationContext before delegating the call to it, and since
AdvancedMockContext returns |this| in getApplicationContext, this leads to a
loop.

This CL adds overrides for these two methods that make the calls to the base
context instead, which will typically either be a MockContext or the target
context being instrumented.

BUG=394464

Review URL: https://codereview.chromium.org/404553005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284023 0039d316-1c4b-4281-b951-d872f2087c98
base/android/javatests/src/org/chromium/base/AdvancedMockContextTest.java [new file with mode: 0644]
base/test/android/javatests/src/org/chromium/base/test/util/AdvancedMockContext.java