summaryrefslogtreecommitdiffstats
path: root/remoting/test/app_remoting_test_driver_environment.cc
diff options
context:
space:
mode:
authorjoedow <joedow@chromium.org>2015-07-01 16:28:33 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-01 23:29:01 +0000
commit03430f2677e5a3bb676187ba5acb94383318bfaf (patch)
tree675fd4f8884ba08a0451c9d5ab163636091ef51f /remoting/test/app_remoting_test_driver_environment.cc
parentf7a991a3247562b6e9ddca99ee24923f4924e910 (diff)
downloadchromium_src-03430f2677e5a3bb676187ba5acb94383318bfaf.zip
chromium_src-03430f2677e5a3bb676187ba5acb94383318bfaf.tar.gz
chromium_src-03430f2677e5a3bb676187ba5acb94383318bfaf.tar.bz2
Fixing a crash when the app remoting test driver was run with an invalid gtest filter.
The crash was occurring because TestSuite creates its own AtExitManager before running tests. If the gtest_filter passed in does not find any qualifying tests, then the AtExitManager is not created. However, our Environment object requires an AtExitManager to properly tear itself down otherwise it will crash. The fix is to handle the creation of an AtExitManager ourselves. I've also hoisted the thread's messageloop up to the main function since we can better control its lifetime there. I've updated the Environment class to conditionally create its own MessageLoop so that it can be reused more easily (e.g. in unit tests). BUG= Review URL: https://codereview.chromium.org/1217893011 Cr-Commit-Position: refs/heads/master@{#337135}
Diffstat (limited to 'remoting/test/app_remoting_test_driver_environment.cc')
-rw-r--r--remoting/test/app_remoting_test_driver_environment.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/remoting/test/app_remoting_test_driver_environment.cc b/remoting/test/app_remoting_test_driver_environment.cc
index 73dfda7..e2716be 100644
--- a/remoting/test/app_remoting_test_driver_environment.cc
+++ b/remoting/test/app_remoting_test_driver_environment.cc
@@ -32,8 +32,7 @@ AppRemotingTestDriverEnvironment::AppRemotingTestDriverEnvironment(
refresh_token_file_path_(refresh_token_file_path),
test_access_token_fetcher_(nullptr),
test_refresh_token_store_(nullptr),
- test_remote_host_info_fetcher_(nullptr),
- message_loop_(new base::MessageLoopForIO()) {
+ test_remote_host_info_fetcher_(nullptr) {
DCHECK(!user_name_.empty());
DCHECK(service_environment_ < kUnknownEnvironment);
@@ -50,6 +49,10 @@ bool AppRemotingTestDriverEnvironment::Initialize(
return true;
}
+ if (!base::MessageLoop::current()) {
+ message_loop_.reset(new base::MessageLoopForIO);
+ }
+
// If a unit test has set |test_refresh_token_store_| then we should use it
// below. Note that we do not want to destroy the test object.
scoped_ptr<RefreshTokenStore> temporary_refresh_token_store;