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

Issue 2790063006: [WIP] Adding Mockito support in Android instrumentation tests (Closed)

Created:
3 years, 8 months ago by Zhiqiang Zhang (Slow)
Modified:
3 years, 8 months ago
CC:
chromium-reviews
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[WIP] Adding Mockito support in Android instrumentation tests This CL upgrades Mockito to 2.7.20 to support instrumentation tests. Dependencies are also upgraded/added. Design doc: https://docs.google.com/a/google.com/document/d/1Vla1McDsX3AXDrvOcIqt4HemFcbWxozaoOaYIed4RUk/edit?usp=sharing BUG=638318

Patch Set 1 #

Patch Set 2 : . #

Patch Set 3 : fix proguard warnings #

Patch Set 4 : fixed proguard issue #

Patch Set 5 : fixed library names #

Patch Set 6 : trying to fix proguard shrinking issue #

Patch Set 7 : disable multidex for debug builds #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+535 lines, -350 lines) Patch
M DEPS View 1 2 3 4 2 chunks +30 lines, -3 lines 0 comments Download
M chrome/android/BUILD.gn View 1 2 3 4 5 6 2 chunks +5 lines, -0 lines 0 comments Download
M chrome/android/java_sources.gni View 1 1 chunk +1 line, -0 lines 0 comments Download
A chrome/android/javatests/src/org/chromium/chrome/test/MockitoTest.java View 1 2 1 chunk +49 lines, -0 lines 0 comments Download
M third_party/.gitignore View 1 2 3 4 3 chunks +3 lines, -2 lines 0 comments Download
A third_party/android_dalvik_dx/BUILD.gn View 1 2 3 4 1 chunk +13 lines, -0 lines 0 comments Download
A third_party/android_dalvik_dx/LICENSE View 1 2 3 4 5 1 chunk +185 lines, -0 lines 0 comments Download
A third_party/android_dalvik_dx/lib/dalvik-dx-7.1.0_r7.jar.sha1 View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
A + third_party/android_libcore_dex/BUILD.gn View 1 2 3 4 1 chunk +3 lines, -3 lines 0 comments Download
A third_party/android_libcore_dex/LICENSE View 1 2 3 4 5 1 chunk +185 lines, -0 lines 0 comments Download
A third_party/android_libcore_dex/lib/libcore-dex-7.1.0_r7.jar.sha1 View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M third_party/byte_buddy/BUILD.gn View 1 2 3 4 1 chunk +19 lines, -1 line 0 comments Download
M third_party/byte_buddy/README.chromium View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
D third_party/byte_buddy/lib/byte-buddy-1.4.17.jar.sha1 View 1 chunk +0 lines, -1 line 0 comments Download
A third_party/byte_buddy/lib/byte-buddy-1.6.12.jar.sha1 View 1 chunk +1 line, -0 lines 0 comments Download
A third_party/byte_buddy/lib/byte-buddy-agent-1.6.12.jar.sha1 View 1 chunk +1 line, -0 lines 0 comments Download
A third_party/byte_buddy/lib/byte-buddy-android-1.6.12.jar.sha1 View 1 chunk +1 line, -0 lines 0 comments Download
A third_party/byte_buddy/proguard.flags View 1 2 3 4 5 1 chunk +6 lines, -0 lines 0 comments Download
M third_party/mockito/BUILD.gn View 1 2 1 chunk +15 lines, -335 lines 0 comments Download
M third_party/mockito/README.chromium View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
A third_party/mockito/lib/mockito-android-2.7.20.jar.sha1 View 1 chunk +1 line, -0 lines 0 comments Download
A third_party/mockito/lib/mockito-core-2.7.20.jar.sha1 View 1 chunk +1 line, -0 lines 0 comments Download
A third_party/mockito/proguard.flags View 1 2 3 4 5 1 chunk +6 lines, -0 lines 2 comments Download
M third_party/objenesis/BUILD.gn View 1 2 1 chunk +3 lines, -1 line 0 comments Download
M third_party/objenesis/README.chromium View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
D third_party/objenesis/lib/objenesis-2.4.jar.sha1 View 1 chunk +0 lines, -1 line 0 comments Download
A third_party/objenesis/lib/objenesis-2.5.1.jar.sha1 View 1 chunk +1 line, -0 lines 0 comments Download
A third_party/objenesis/proguard.flags View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 32 (22 generated)
Zhiqiang Zhang (Slow)
PTAL this initial patch. I need to add/update the LICENSE and README files
3 years, 8 months ago (2017-04-04 18:41:46 UTC) #2
mikecase (-- gone --)
You may be asked to split out the things you are adding to third_party/ into ...
3 years, 8 months ago (2017-04-04 19:24:13 UTC) #5
Zhiqiang Zhang (Slow)
+agrieve@ for a proguard/dex issue on release builds. The problem is: I need to keep ...
3 years, 8 months ago (2017-04-05 15:47:25 UTC) #21
Zhiqiang Zhang (Slow)
On 2017/04/05 at 15:47:25, Zhiqiang Zhang wrote: > +agrieve@ for a proguard/dex issue on release ...
3 years, 8 months ago (2017-04-05 16:11:01 UTC) #22
Zhiqiang Zhang (Slow)
On 2017/04/05 at 16:11:01, Zhiqiang Zhang wrote: > On 2017/04/05 at 15:47:25, Zhiqiang Zhang wrote: ...
3 years, 8 months ago (2017-04-05 17:30:15 UTC) #25
agrieve
On 2017/04/05 17:30:15, Zhiqiang Zhang wrote: > On 2017/04/05 at 16:11:01, Zhiqiang Zhang wrote: > ...
3 years, 8 months ago (2017-04-05 19:43:51 UTC) #28
Zhiqiang Zhang (Slow)
> I think it would be much better to just add some -keep rules to ...
3 years, 8 months ago (2017-04-05 22:03:07 UTC) #29
agrieve
On 2017/04/05 22:03:07, Zhiqiang Zhang wrote: > > I think it would be much better ...
3 years, 8 months ago (2017-04-06 00:03:13 UTC) #30
agrieve
https://codereview.chromium.org/2790063006/diff/120001/third_party/mockito/proguard.flags File third_party/mockito/proguard.flags (right): https://codereview.chromium.org/2790063006/diff/120001/third_party/mockito/proguard.flags#newcode3 third_party/mockito/proguard.flags:3: -dontshrink Ah, okay, this is what you've done. These ...
3 years, 8 months ago (2017-04-06 00:04:44 UTC) #31
Zhiqiang Zhang (Slow)
3 years, 8 months ago (2017-04-06 14:02:43 UTC) #32
Interesting..
I'm checking the number of methods when is_java_debug is true and false before
adding mockito (i.e. on my trunk).

When is_java_debug is false, the number of methods is 64049, while it is 38273
when is_java_debug is false. It surprises me that release builds has more
methods.

Filed https://crbug.com/709007 for tracking the number of methods issue.

It's very easy to exceed to 64K methods limit when adding mockito/bytebuddy,
which needs adds at least 2K methods.

We should probably fix why release builds has more methods first.

Also, I tried using multidex but it seems that it doesn't work very well with
chrome_public_test_apk. It always complain about "too many classes in
--main-dex-list, main dex capacity exceeded"

https://codereview.chromium.org/2790063006/diff/120001/third_party/mockito/pr...
File third_party/mockito/proguard.flags (right):

https://codereview.chromium.org/2790063006/diff/120001/third_party/mockito/pr...
third_party/mockito/proguard.flags:3: -dontshrink
On 2017/04/06 at 00:04:44, agrieve wrote:
> Ah, okay, this is what you've done.
> 
> These will apply globally. I don't think it's what you want to do. You should
scope these down so they apply only to mockito.

OK, I realize that the proguard rule is the combination of all rule files, not
scoped to individual targets.

Powered by Google App Engine
This is Rietveld 408576698