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

Side by Side Diff: dbus/signal_sender_verification_unittest.cc

Issue 24673006: dbus: Stop accessing ObjectProxy::name_owner_changed_callback_ on the D-Bus thread (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « dbus/object_proxy.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/metrics/histogram_samples.h" 9 #include "base/metrics/histogram_samples.h"
10 #include "base/metrics/statistics_recorder.h" 10 #include "base/metrics/statistics_recorder.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 FROM_HERE, 113 FROM_HERE,
114 base::Bind(&SignalSenderVerificationTest::OnOwnershipInternal, 114 base::Bind(&SignalSenderVerificationTest::OnOwnershipInternal,
115 base::Unretained(this))); 115 base::Unretained(this)));
116 } 116 }
117 117
118 void OnOwnershipInternal() { 118 void OnOwnershipInternal() {
119 on_ownership_called_ = true; 119 on_ownership_called_ = true;
120 message_loop_.Quit(); 120 message_loop_.Quit();
121 } 121 }
122 122
123 void OnNameOwnerChanged(bool* called_flag, Signal* signal) { 123 void OnNameOwnerChanged(bool* called_flag,
124 MessageReader reader(signal); 124 const std::string& old_owner,
125 std::string name, old_owner, new_owner; 125 const std::string& new_owner) {
126 ASSERT_TRUE(reader.PopString(&name));
127 ASSERT_TRUE(reader.PopString(&old_owner));
128 ASSERT_TRUE(reader.PopString(&new_owner));
129 latest_name_owner_ = new_owner; 126 latest_name_owner_ = new_owner;
130 *called_flag = true; 127 *called_flag = true;
131 message_loop_.Quit(); 128 message_loop_.Quit();
132 } 129 }
133 130
134 // Called when the "Test" signal is received, in the main thread. 131 // Called when the "Test" signal is received, in the main thread.
135 // Copy the string payload to |test_signal_string_|. 132 // Copy the string payload to |test_signal_string_|.
136 void OnTestSignal(Signal* signal) { 133 void OnTestSignal(Signal* signal) {
137 MessageReader reader(signal); 134 MessageReader reader(signal);
138 ASSERT_TRUE(reader.PopString(&test_signal_string_)); 135 ASSERT_TRUE(reader.PopString(&test_signal_string_));
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 372
376 // Now the second service owns the name. 373 // Now the second service owns the name.
377 const char kNewMessage[] = "hello, new world"; 374 const char kNewMessage[] = "hello, new world";
378 375
379 test_service2_->SendTestSignal(kNewMessage); 376 test_service2_->SendTestSignal(kNewMessage);
380 WaitForTestSignal(); 377 WaitForTestSignal();
381 ASSERT_EQ(kNewMessage, test_signal_string_); 378 ASSERT_EQ(kNewMessage, test_signal_string_);
382 } 379 }
383 380
384 } // namespace dbus 381 } // namespace dbus
OLDNEW
« no previous file with comments | « dbus/object_proxy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698