OLD | NEW |
---|---|
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 <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 "content/browser/device_orientation/data_fetcher.h" | 9 #include "content/browser/device_orientation/data_fetcher.h" |
10 #include "content/browser/device_orientation/orientation.h" | 10 #include "content/browser/device_orientation/orientation.h" |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 provider_ = NULL; | 158 provider_ = NULL; |
159 | 159 |
160 // Make sure it is really gone. | 160 // Make sure it is really gone. |
161 EXPECT_FALSE(Provider::GetInstanceForTests()); | 161 EXPECT_FALSE(Provider::GetInstanceForTests()); |
162 | 162 |
163 // Clean up in any case, so as to not break subsequent test. | 163 // Clean up in any case, so as to not break subsequent test. |
164 Provider::SetInstanceForTests(NULL); | 164 Provider::SetInstanceForTests(NULL); |
165 } | 165 } |
166 | 166 |
167 // Initialize the test fixture with a ProviderImpl that uses the | 167 // Initialize the test fixture with a ProviderImpl that uses the |
168 // DataFetcherFactories in the null-terminated factories array. | |
169 void Init(ProviderImpl::DataFetcherFactory* factories) { | |
170 provider_ = new ProviderImpl(factories); | |
171 Provider::SetInstanceForTests(provider_); | |
172 } | |
173 | |
174 // Initialize the test fixture with a ProviderImpl that uses the | |
175 // DataFetcherFactory factory. | 168 // DataFetcherFactory factory. |
176 void Init(ProviderImpl::DataFetcherFactory factory) { | 169 void Init(ProviderImpl::DataFetcherFactory factory) { |
177 ProviderImpl::DataFetcherFactory factories[] = { factory, NULL }; | 170 provider_ = new ProviderImpl(&factory); |
hans
2012/08/01 19:08:47
here too i think it's just the value that should b
aousterh
2012/08/02 10:10:38
Done.
| |
178 Init(factories); | 171 Provider::SetInstanceForTests(provider_); |
179 } | 172 } |
180 | 173 |
181 protected: | 174 protected: |
182 // Number of pending expectations. | 175 // Number of pending expectations. |
183 int pending_expectations_; | 176 int pending_expectations_; |
184 | 177 |
185 // Provider instance under test. | 178 // Provider instance under test. |
186 scoped_refptr<Provider> provider_; | 179 scoped_refptr<Provider> provider_; |
187 | 180 |
188 // Message loop for the test thread. | 181 // Message loop for the test thread. |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
462 MessageLoop::current()->Run(); | 455 MessageLoop::current()->Run(); |
463 | 456 |
464 provider_->RemoveObserver(checker_a.get()); | 457 provider_->RemoveObserver(checker_a.get()); |
465 provider_->RemoveObserver(checker_b.get()); | 458 provider_->RemoveObserver(checker_b.get()); |
466 MockOrientationFactory::SetCurInstance(NULL); | 459 MockOrientationFactory::SetCurInstance(NULL); |
467 } | 460 } |
468 | 461 |
469 } // namespace | 462 } // namespace |
470 | 463 |
471 } // namespace device_orientation | 464 } // namespace device_orientation |
OLD | NEW |