Allow changing AppWindowClient for tests
AppWindowClient::Set sets the global AppWindowClient. Unit tests sometimes call it more than once, e.g. when multiple BrowserProcesses are created. Currently, each additional call silently returns instead of changing g_client. Even Set(nullptr) does nothing. Normally, this is fine: only tests should call it more than once, and usually it's called with the same value anyway (because BrowserProcess and TestingBrowserProcess both use the global ChromeAppWindowClient singleton). Some tests do create and destroy unique AppWindowClients, like ones in app_shell_unittest. This CL allows g_client to be changed to nullptr and then to a new value. Otherwise, since these tests run sequentially in the same process, g_client may point to freed memory. This will become an issue as we add more tests here. Bug: 751242 Change-Id: I1bfa8f12f1fbbd5e086ae3c033e038b93c5a18ce Reviewed-on: https://chromium-review.googlesource.com/593052 Commit-Queue: Michael Giuffrida <michaelpg@chromium.org> Reviewed-by:Scott Violet <sky@chromium.org> Reviewed-by:
Devlin <rdevlin.cronin@chromium.org> Cr-Commit-Position: refs/heads/master@{#491645}
Showing
Please register or sign in to comment