forked from robolectric/robolectric
-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
shadow_context_wrapper #2
Open
jongerrish
wants to merge
49
commits into
remove_shadow_context_wrapper
Choose a base branch
from
shadow_context_wrapper
base: remove_shadow_context_wrapper
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…text_wrapper Remove ShadowResources.{getResourceLoader(),getQualifiers(),getResName()} prefer to go direct to ShadowAssetManager for this. Part of work to remove excess shadowing of resources.
…ionClass() so that we can use the Android Framework Instrumentation class to create and bind the application for us rather than doing it ourselves via reflection in ParallelUniverse. Switch usages of ShadowApplication.getResources() to Application.getResources()
…ead callers should access it through ShadowAssetManager
…text_get_resource_loader Stop exposing ResourceLoader through ShadowContext + subclasses.
…obolectric into fix-set-runtimeapplicationASAP
…ded in the android-all jars.
…cationASAP Set RuntimeEnvironment.application sooner
… exceptions would have been silently dropped
…_initialiser_exceptions Display exceptions thrown during initialisation of static value.
…depenencies Remove redundant dependencies.
Extended ShadowBitmap to write and be created from Parcel.
…text e.g: created within RemoteViews.
…om_context Avoid npe in custom context
…of exposing the ResourceLoader and qualifiers.
Make ShadowAssetManager.resolveStyle() non-static
…ation getResourceLoader fix & new createAttributeSet API
Remove getAssets(), getResources(), getText(), getString(int) and getString(int, Object..) from ShadowContext and subclasses. We should use framework code instead. It is suspected that the excessive shadowing here is causing:- robolectric#2315
…in_shadow_context_wrapper ShadowContextWrapper cleanup
Remove ShadowContext.getShadowApplication() - use ShadowApplication.getInstance() instead. Remove isStringI18n() which has no effect Prefer Framework's getMainLooper() rather than storing our own.
…o-ShadowAssetManager Migrate createAttributeSet to static RoboAttributeSet#create
…buteSet RoboAttributeSet API changes
…egate class and shadowing here was probably done for convenience (all components are ContextWrappers) but in reality should be done on the base context, the delegate. The liberal use of shadowing here prevents certain tricks that AppCompat uses, e.g: emulating SVG on pre-21 devices by subclassing ShadowContextWrapper to provide their own custom Resources. This change removes the shadowing from ContextWrapper as well as some shadowing from ShadowService, ShadowActivity and ShadowApplication and pushes it to ContextImpl, the base context which is a central location. Some shadowing is still redirected to ShadowApplication since this hosts much of the environment recording logic, e.g: started activities and servcies. In a future PR we should move this to a new class, e.g: RuntimeEnvironment.getInstance().peekNextStartedActivity() and deprecate / remove those methods. Move code from ShadowContextWrapper to ShadowContextImpl. Move methods from ShadowActivity,ShadowApplication to ShadowContextImpl Framework code expects all compontents to have a base context, so prefer Robolectric.{build,setup}{Activity,Service} Base context (ContextImpl) should always exist so no need to fall back on RuntimeEnvironment.application. Pass activity thread rather than null to Activity.attach(). Remove ComponentController.withBaseContext() should not be necessary since base context should be setup by the environment. Remove CoreShadowAdapter.setPackageName() since its redundant since @config(packageName = "..."). Prefer Application.getPackageManager() over ShadowApplication.getPackageManager(). Sacrificed ShadowApplication.assertNoBroadcastListenersRegistered() since the calls come from the base context (ContextImpl) its not possible to know the originating outer Context. Remove ShadowPreferenceManager + Test.
Remove ShadowContext.getShadowApplication() - use ShadowApplication.getInstance() instead. Remove isStringI18n() which has no effect Prefer Framework's getMainLooper() rather than storing our own.
…egate class and shadowing here was probably done for convenience (all components are ContextWrappers) but in reality should be done on the base context, the delegate. The liberal use of shadowing here prevents certain tricks that AppCompat uses, e.g: emulating SVG on pre-21 devices by subclassing ShadowContextWrapper to provide their own custom Resources. This change removes the shadowing from ContextWrapper as well as some shadowing from ShadowService, ShadowActivity and ShadowApplication and pushes it to ContextImpl, the base context which is a central location. Some shadowing is still redirected to ShadowApplication since this hosts much of the environment recording logic, e.g: started activities and servcies. In a future PR we should move this to a new class, e.g: RuntimeEnvironment.getInstance().peekNextStartedActivity() and deprecate / remove those methods. Move code from ShadowContextWrapper to ShadowContextImpl. Move methods from ShadowActivity,ShadowApplication to ShadowContextImpl Framework code expects all compontents to have a base context, so prefer Robolectric.{build,setup}{Activity,Service} Base context (ContextImpl) should always exist so no need to fall back on RuntimeEnvironment.application. Pass activity thread rather than null to Activity.attach(). Remove ComponentController.withBaseContext() should not be necessary since base context should be setup by the environment. Remove CoreShadowAdapter.setPackageName() since its redundant since @config(packageName = "..."). Prefer Application.getPackageManager() over ShadowApplication.getPackageManager(). Sacrificed ShadowApplication.assertNoBroadcastListenersRegistered() since the calls come from the base context (ContextImpl) its not possible to know the originating outer Context. Remove ShadowPreferenceManager + Test.
…egate class and shadowing here was probably done for convenience (all components are ContextWrappers) but in reality should be done on the base context, the delegate. The liberal use of shadowing here prevents certain tricks that AppCompat uses, e.g: emulating SVG on pre-21 devices by subclassing ShadowContextWrapper to provide their own custom Resources. This change removes the shadowing from ContextWrapper as well as some shadowing from ShadowService, ShadowActivity and ShadowApplication and pushes it to ContextImpl, the base context which is a central location. Some shadowing is still redirected to ShadowApplication since this hosts much of the environment recording logic, e.g: started activities and servcies. In a future PR we should move this to a new class, e.g: RuntimeEnvironment.getInstance().peekNextStartedActivity() and deprecate / remove those methods. Move code from ShadowContextWrapper to ShadowContextImpl. Move methods from ShadowActivity,ShadowApplication to ShadowContextImpl Framework code expects all compontents to have a base context, so prefer Robolectric.{build,setup}{Activity,Service} Base context (ContextImpl) should always exist so no need to fall back on RuntimeEnvironment.application. Pass activity thread rather than null to Activity.attach(). Remove ComponentController.withBaseContext() should not be necessary since base context should be setup by the environment. Remove CoreShadowAdapter.setPackageName() since its redundant since @config(packageName = "..."). Prefer Application.getPackageManager() over ShadowApplication.getPackageManager(). Sacrificed ShadowApplication.assertNoBroadcastListenersRegistered() since the calls come from the base context (ContextImpl) its not possible to know the originating outer Context. Remove ShadowPreferenceManager + Test. Better creation API for RoboAttributeSet Major RoboAttributeSet changes
…dow_context_wrapper # Conflicts: # robolectric-shadows/shadows-core/src/main/java/org/robolectric/shadows/ShadowContext.java # robolectric/src/test/java/org/robolectric/shadows/ShadowServiceTest.java
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.