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

Side by Side Diff: dbus/end_to_end_async_unittest.cc

Issue 8907010: Fix flaky tests in EndToEndAsyncTest in dbus_unittests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 | « no previous file | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 57
58 // Connect to the "Test" signal of "org.chromium.TestInterface" from 58 // Connect to the "Test" signal of "org.chromium.TestInterface" from
59 // the remote object. 59 // the remote object.
60 object_proxy_->ConnectToSignal( 60 object_proxy_->ConnectToSignal(
61 "org.chromium.TestInterface", 61 "org.chromium.TestInterface",
62 "Test", 62 "Test",
63 base::Bind(&EndToEndAsyncTest::OnTestSignal, 63 base::Bind(&EndToEndAsyncTest::OnTestSignal,
64 base::Unretained(this)), 64 base::Unretained(this)),
65 base::Bind(&EndToEndAsyncTest::OnConnected, 65 base::Bind(&EndToEndAsyncTest::OnConnected,
66 base::Unretained(this))); 66 base::Unretained(this)));
67 // Wait until the object proxy is connected to the signal.
68 message_loop_.Run();
69
67 // Connect to the "Test2" signal of "org.chromium.TestInterface" from 70 // Connect to the "Test2" signal of "org.chromium.TestInterface" from
68 // the remote object. There was a bug where we were emitting error 71 // the remote object. There was a bug where we were emitting error
69 // messages like "Requested to remove an unknown match rule: ..." at 72 // messages like "Requested to remove an unknown match rule: ..." at
70 // the shutdown of Bus when an object proxy is connected to more than 73 // the shutdown of Bus when an object proxy is connected to more than
71 // one signal of the same interface. See crosbug.com/23382 for details. 74 // one signal of the same interface. See crosbug.com/23382 for details.
72 object_proxy_->ConnectToSignal( 75 object_proxy_->ConnectToSignal(
73 "org.chromium.TestInterface", 76 "org.chromium.TestInterface",
74 "Test2", 77 "Test2",
75 base::Bind(&EndToEndAsyncTest::OnTest2Signal, 78 base::Bind(&EndToEndAsyncTest::OnTest2Signal,
76 base::Unretained(this)), 79 base::Unretained(this)),
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 dbus::ObjectProxy::EmptyResponseCallback()); 281 dbus::ObjectProxy::EmptyResponseCallback());
279 // Post a delayed task to quit the message loop. 282 // Post a delayed task to quit the message loop.
280 message_loop_.PostDelayedTask(FROM_HERE, 283 message_loop_.PostDelayedTask(FROM_HERE,
281 MessageLoop::QuitClosure(), 284 MessageLoop::QuitClosure(),
282 TestTimeouts::tiny_timeout_ms()); 285 TestTimeouts::tiny_timeout_ms());
283 message_loop_.Run(); 286 message_loop_.Run();
284 // We cannot tell if the empty callback is called, but at least we can 287 // We cannot tell if the empty callback is called, but at least we can
285 // check if the test does not crash. 288 // check if the test does not crash.
286 } 289 }
287 290
288 // Flaky, http://crbug.com/107301 291 TEST_F(EndToEndAsyncTest, TestSignal) {
289 TEST_F(EndToEndAsyncTest, FLAKY_TestSignal) {
290 const char kMessage[] = "hello, world"; 292 const char kMessage[] = "hello, world";
291 // Send the test signal from the exported object. 293 // Send the test signal from the exported object.
292 test_service_->SendTestSignal(kMessage); 294 test_service_->SendTestSignal(kMessage);
293 // Receive the signal with the object proxy. The signal is handled in 295 // Receive the signal with the object proxy. The signal is handled in
294 // EndToEndAsyncTest::OnTestSignal() in the main thread. 296 // EndToEndAsyncTest::OnTestSignal() in the main thread.
295 WaitForTestSignal(); 297 WaitForTestSignal();
296 ASSERT_EQ(kMessage, test_signal_string_); 298 ASSERT_EQ(kMessage, test_signal_string_);
297 } 299 }
298 300
299 // Flaky, http://crbug.com/106796 301 TEST_F(EndToEndAsyncTest, TestSignalFromRoot) {
300 TEST_F(EndToEndAsyncTest, FLAKY_TestSignalFromRoot) {
301 const char kMessage[] = "hello, world"; 302 const char kMessage[] = "hello, world";
302 // Send the test signal from the root object path, to see if we can 303 // Send the test signal from the root object path, to see if we can
303 // handle signals sent from "/", like dbus-send does. 304 // handle signals sent from "/", like dbus-send does.
304 test_service_->SendTestSignalFromRoot(kMessage); 305 test_service_->SendTestSignalFromRoot(kMessage);
305 // Receive the signal with the object proxy. The signal is handled in 306 // Receive the signal with the object proxy. The signal is handled in
306 // EndToEndAsyncTest::OnTestSignal() in the main thread. 307 // EndToEndAsyncTest::OnTestSignal() in the main thread.
307 WaitForTestSignal(); 308 WaitForTestSignal();
308 ASSERT_EQ(kMessage, test_signal_string_); 309 ASSERT_EQ(kMessage, test_signal_string_);
309 } 310 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698