Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(555)

Issue 404553005: Fix StackOverFlow in AdvancedMockContext. (Closed)

Created:
6 years, 5 months ago by nyquist
Modified:
6 years, 5 months ago
Reviewers:
Yaron
CC:
chromium-reviews, erikwright+watch_chromium.org
Project:
chromium
Visibility:
Public.

Description

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 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=284023

Patch Set 1 #

Total comments: 2

Patch Set 2 : Added test. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+83 lines, -0 lines) Patch
A base/android/javatests/src/org/chromium/base/AdvancedMockContextTest.java View 1 1 chunk +68 lines, -0 lines 0 comments Download
M base/test/android/javatests/src/org/chromium/base/test/util/AdvancedMockContext.java View 3 chunks +15 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (0 generated)
nyquist
yfriedman: PTAL
6 years, 5 months ago (2014-07-17 17:51:51 UTC) #1
Yaron
https://codereview.chromium.org/404553005/diff/1/base/test/android/javatests/src/org/chromium/base/test/util/AdvancedMockContext.java File base/test/android/javatests/src/org/chromium/base/test/util/AdvancedMockContext.java (right): https://codereview.chromium.org/404553005/diff/1/base/test/android/javatests/src/org/chromium/base/test/util/AdvancedMockContext.java#newcode70 base/test/android/javatests/src/org/chromium/base/test/util/AdvancedMockContext.java:70: getBaseContext().registerComponentCallbacks(callback); I think for contexts which don't override this, ...
6 years, 5 months ago (2014-07-17 20:06:47 UTC) #2
nyquist
https://codereview.chromium.org/404553005/diff/1/base/test/android/javatests/src/org/chromium/base/test/util/AdvancedMockContext.java File base/test/android/javatests/src/org/chromium/base/test/util/AdvancedMockContext.java (right): https://codereview.chromium.org/404553005/diff/1/base/test/android/javatests/src/org/chromium/base/test/util/AdvancedMockContext.java#newcode70 base/test/android/javatests/src/org/chromium/base/test/util/AdvancedMockContext.java:70: getBaseContext().registerComponentCallbacks(callback); On 2014/07/17 20:06:47, Yaron wrote: > I think ...
6 years, 5 months ago (2014-07-18 00:35:18 UTC) #3
Yaron
lgtm
6 years, 5 months ago (2014-07-18 00:52:58 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/nyquist@chromium.org/404553005/20001
6 years, 5 months ago (2014-07-18 00:56:17 UTC) #5
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: win_chromium_rel on tryserver.chromium ...
6 years, 5 months ago (2014-07-18 05:40:32 UTC) #6
commit-bot: I haz the power
6 years, 5 months ago (2014-07-18 07:12:58 UTC) #7
Message was sent while issue was closed.
Change committed as 284023

Powered by Google App Engine
This is Rietveld 408576698