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

Side by Side Diff: content/browser/device_orientation/provider_unittest.cc

Issue 10837055: Changes ProviderImpl to use a single DataFetcherFactory (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixes comment Created 8 years, 4 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
« no previous file with comments | « content/browser/device_orientation/provider_impl.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 <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
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);
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
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
OLDNEW
« no previous file with comments | « content/browser/device_orientation/provider_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698