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

Side by Side Diff: content/browser/battery_status/battery_monitor_integration_browsertest.cc

Issue 2633053002: Remove the MessageLoop::DestructionObserver from mojo bindings. (Closed)
Patch Set: rebase Created 3 years, 10 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 <utility> 5 #include <utility>
6 6
7 #include "base/callback_list.h" 7 #include "base/callback_list.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 21 matching lines...) Expand all
32 namespace { 32 namespace {
33 33
34 typedef base::CallbackList<void(const device::BatteryStatus&)> 34 typedef base::CallbackList<void(const device::BatteryStatus&)>
35 BatteryUpdateCallbackList; 35 BatteryUpdateCallbackList;
36 typedef BatteryUpdateCallbackList::Subscription BatteryUpdateSubscription; 36 typedef BatteryUpdateCallbackList::Subscription BatteryUpdateSubscription;
37 37
38 // Global battery state used in the tests. 38 // Global battery state used in the tests.
39 device::BatteryStatus g_battery_status; 39 device::BatteryStatus g_battery_status;
40 // Global list of test battery monitors to notify when |g_battery_status| 40 // Global list of test battery monitors to notify when |g_battery_status|
41 // changes. 41 // changes.
42 base::LazyInstance<BatteryUpdateCallbackList> g_callback_list = 42 base::LazyInstance<BatteryUpdateCallbackList>::Leaky g_callback_list =
43 LAZY_INSTANCE_INITIALIZER; 43 LAZY_INSTANCE_INITIALIZER;
44 44
45 // Updates the global battery state and notifies existing test monitors. 45 // Updates the global battery state and notifies existing test monitors.
46 void UpdateBattery(const device::BatteryStatus& battery_status) { 46 void UpdateBattery(const device::BatteryStatus& battery_status) {
47 g_battery_status = battery_status; 47 g_battery_status = battery_status;
48 g_callback_list.Get().Notify(battery_status); 48 g_callback_list.Get().Notify(battery_status);
49 } 49 }
50 50
51 class FakeBatteryMonitor : public device::BatteryMonitor { 51 class FakeBatteryMonitor : public device::BatteryMonitor {
52 public: 52 public:
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 TestNavigationObserver same_tab_observer2(shell()->web_contents(), 1); 181 TestNavigationObserver same_tab_observer2(shell()->web_contents(), 1);
182 status.level = 0.6; 182 status.level = 0.6;
183 UpdateBattery(status); 183 UpdateBattery(status);
184 same_tab_observer2.Wait(); 184 same_tab_observer2.Wait();
185 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref()); 185 EXPECT_EQ("pass", shell()->web_contents()->GetLastCommittedURL().ref());
186 } 186 }
187 187
188 } // namespace 188 } // namespace
189 189
190 } // namespace content 190 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/media/router/presentation_service_delegate_observers.cc ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698