Skip to content
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

feat: Add an API to simulate the Low Memory warning #833

Closed
wants to merge 1 commit into from

Conversation

@mykola-mokhnach
Copy link
Author

@KazuCocoa @Dan-Maor Could you please test this API with a real app that actually has the didReceiveMemoryWarning defined?

@Dan-Maor
Copy link
Collaborator

I will give it a test tomorrow.
Are you sure this selector will simulate the memory warning on the app under test? From what I remember [UIApplication sharedApplication] is the currently executed application, in this case it will be WebDriverAgent itself.

@mykola-mokhnach
Copy link
Author

I will give it a test tomorrow. Are you sure this selector will simulate the memory warning on the app under test? From what I remember [UIApplication sharedApplication] is the currently executed application, in this case it will be WebDriverAgent itself.

I expect WDA to be in background, so sharedApplication returns the currently running/foreground app. This assumption needs to be confirmed though.

@KazuCocoa
Copy link
Member

It will take more time to test. I'll test with tvOS as well. (will create a simple app with didReceiveMemoryWarning and to test, maybe can be done in this week)

@Dan-Maor
Copy link
Collaborator

According to the documentation, [UIApplication sharedApplication] is tied to the executing application's UIApplicationMain, so it doesn't look like it's related to the application in the foreground.
https://developer.apple.com/documentation/uikit/uiapplication/1622975-sharedapplication
I've confirmed it by invoking applicationState on the object, and the returned state is UIApplicationStateBackground, meaning it is tied to the executing application (WDA) as I've suspected.

I wrote a quick app which handles applicationDidReceiveMemoryWarning by just printing a log line, however calling the WDA command doesn't look like it has any effect on the app as the function is not invoked.

@mykola-mokhnach mykola-mokhnach deleted the sim_mem_warn branch January 27, 2024 16:51
@mykola-mokhnach
Copy link
Author

@Dan-Maor Thanks for checking it. I will try a different approach then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants