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

Side by Side Diff: extensions/browser/api_test_utils.cc

Issue 1389163008: Don't use base::MessageLoop::{Quit,QuitClosure} in extensions/, ipc/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/browser/api_test_utils.h" 5 #include "extensions/browser/api_test_utils.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "components/crx_file/id_util.h" 10 #include "components/crx_file/id_util.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 void OnSendResponse(UIThreadExtensionFunction* function, 50 void OnSendResponse(UIThreadExtensionFunction* function,
51 bool success, 51 bool success,
52 bool bad_message) override { 52 bool bad_message) override {
53 ASSERT_FALSE(bad_message); 53 ASSERT_FALSE(bad_message);
54 ASSERT_FALSE(HasResponse()); 54 ASSERT_FALSE(HasResponse());
55 response_.reset(new bool); 55 response_.reset(new bool);
56 *response_ = success; 56 *response_ = success;
57 if (should_post_quit_) { 57 if (should_post_quit_) {
58 base::MessageLoopForUI::current()->Quit(); 58 base::MessageLoopForUI::current()->QuitWhenIdle();
59 } 59 }
60 } 60 }
61 61
62 private: 62 private:
63 scoped_ptr<bool> response_; 63 scoped_ptr<bool> response_;
64 bool should_post_quit_; 64 bool should_post_quit_;
65 }; 65 };
66 66
67 } // namespace 67 } // namespace
68 68
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 response_delegate.set_should_post_quit(true); 235 response_delegate.set_should_post_quit(true);
236 content::RunMessageLoop(); 236 content::RunMessageLoop();
237 } 237 }
238 238
239 EXPECT_TRUE(response_delegate.HasResponse()); 239 EXPECT_TRUE(response_delegate.HasResponse());
240 return response_delegate.GetResponse(); 240 return response_delegate.GetResponse();
241 } 241 }
242 242
243 } // namespace api_test_utils 243 } // namespace api_test_utils
244 } // namespace extensions 244 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/alarms/alarms_api_unittest.cc ('k') | extensions/browser/extension_icon_image_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698