| OLD | NEW |
| 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 <queue> | 5 #include <queue> |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/synchronization/lock.h" | 8 #include "base/synchronization/lock.h" |
| 9 #include "base/task.h" | 9 #include "base/task.h" |
| 10 #include "content/browser/device_orientation/data_fetcher.h" | 10 #include "content/browser/device_orientation/data_fetcher.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 checker_c->AddExpectation(kTestOrientations[1]); | 241 checker_c->AddExpectation(kTestOrientations[1]); |
| 242 checker_c->AddExpectation(kTestOrientations[2]); | 242 checker_c->AddExpectation(kTestOrientations[2]); |
| 243 orientation_factory->SetOrientation(kTestOrientations[2]); | 243 orientation_factory->SetOrientation(kTestOrientations[2]); |
| 244 provider_->AddObserver(checker_c.get()); | 244 provider_->AddObserver(checker_c.get()); |
| 245 MessageLoop::current()->Run(); | 245 MessageLoop::current()->Run(); |
| 246 | 246 |
| 247 provider_->RemoveObserver(checker_b.get()); | 247 provider_->RemoveObserver(checker_b.get()); |
| 248 provider_->RemoveObserver(checker_c.get()); | 248 provider_->RemoveObserver(checker_c.get()); |
| 249 } | 249 } |
| 250 | 250 |
| 251 // Flaky. See crbug.com/104950. | 251 #if defined(OS_LINUX) |
| 252 TEST_F(DeviceOrientationProviderTest, FLAKY_ObserverNotRemoved) { | 252 // Flakily DCHECKs on Linux. See crbug.com/104950. |
| 253 #define MAYBE_ObserverNotRemoved DISABLED_ObserverNotRemoved |
| 254 #else |
| 255 #define MAYBE_ObserverNotRemoved ObserverNotRemoved |
| 256 #endif |
| 257 TEST_F(DeviceOrientationProviderTest, MAYBE_ObserverNotRemoved) { |
| 253 scoped_refptr<MockOrientationFactory> orientation_factory( | 258 scoped_refptr<MockOrientationFactory> orientation_factory( |
| 254 new MockOrientationFactory()); | 259 new MockOrientationFactory()); |
| 255 Init(MockOrientationFactory::CreateDataFetcher); | 260 Init(MockOrientationFactory::CreateDataFetcher); |
| 256 const Orientation kTestOrientation(true, 1, true, 2, true, 3); | 261 const Orientation kTestOrientation(true, 1, true, 2, true, 3); |
| 257 const Orientation kTestOrientation2(true, 4, true, 5, true, 6); | 262 const Orientation kTestOrientation2(true, 4, true, 5, true, 6); |
| 258 | 263 |
| 259 scoped_ptr<UpdateChecker> checker(new UpdateChecker(&pending_expectations_)); | 264 scoped_ptr<UpdateChecker> checker(new UpdateChecker(&pending_expectations_)); |
| 260 checker->AddExpectation(kTestOrientation); | 265 checker->AddExpectation(kTestOrientation); |
| 261 orientation_factory->SetOrientation(kTestOrientation); | 266 orientation_factory->SetOrientation(kTestOrientation); |
| 262 provider_->AddObserver(checker.get()); | 267 provider_->AddObserver(checker.get()); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 checker_b->AddExpectation(third_orientation); | 372 checker_b->AddExpectation(third_orientation); |
| 368 MessageLoop::current()->Run(); | 373 MessageLoop::current()->Run(); |
| 369 | 374 |
| 370 provider_->RemoveObserver(checker_a.get()); | 375 provider_->RemoveObserver(checker_a.get()); |
| 371 provider_->RemoveObserver(checker_b.get()); | 376 provider_->RemoveObserver(checker_b.get()); |
| 372 } | 377 } |
| 373 | 378 |
| 374 } // namespace | 379 } // namespace |
| 375 | 380 |
| 376 } // namespace device_orientation | 381 } // namespace device_orientation |
| OLD | NEW |