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 #import <Foundation/Foundation.h> | 5 #import <Foundation/Foundation.h> |
6 #import <objc/objc-class.h> | 6 #import <objc/objc-class.h> |
7 | 7 |
8 #include "base/test/scoped_task_scheduler.h" | 8 #include "base/test/scoped_task_environment.h" |
9 #import "chrome/browser/mac/keystone_glue.h" | 9 #import "chrome/browser/mac/keystone_glue.h" |
10 #import "chrome/browser/mac/keystone_registration.h" | 10 #import "chrome/browser/mac/keystone_registration.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 #include "testing/platform_test.h" | 12 #include "testing/platform_test.h" |
13 | 13 |
14 namespace ksr = keystone_registration; | 14 namespace ksr = keystone_registration; |
15 | 15 |
16 | 16 |
17 @interface FakeKeystoneRegistration : KSRegistration | 17 @interface FakeKeystoneRegistration : KSRegistration |
18 @end | 18 @end |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 (installs_ == 0)); | 173 (installs_ == 0)); |
174 } | 174 } |
175 | 175 |
176 @end | 176 @end |
177 | 177 |
178 | 178 |
179 namespace { | 179 namespace { |
180 | 180 |
181 class KeystoneGlueTest : public PlatformTest { | 181 class KeystoneGlueTest : public PlatformTest { |
182 private: | 182 private: |
183 base::test::ScopedTaskScheduler task_scheduler_; | 183 base::test::ScopedTaskEnvironment scoped_task_environment_; |
184 }; | 184 }; |
185 | 185 |
186 // DISABLED because the mocking isn't currently working. | 186 // DISABLED because the mocking isn't currently working. |
187 TEST_F(KeystoneGlueTest, DISABLED_BasicGlobalCreate) { | 187 TEST_F(KeystoneGlueTest, DISABLED_BasicGlobalCreate) { |
188 // Allow creation of a KeystoneGlue by mocking out a few calls | 188 // Allow creation of a KeystoneGlue by mocking out a few calls |
189 SEL ids = @selector(infoDictionary); | 189 SEL ids = @selector(infoDictionary); |
190 IMP oldInfoImp_ = [[KeystoneGlue class] instanceMethodForSelector:ids]; | 190 IMP oldInfoImp_ = [[KeystoneGlue class] instanceMethodForSelector:ids]; |
191 IMP newInfoImp_ = [[FakeKeystoneGlue class] instanceMethodForSelector:ids]; | 191 IMP newInfoImp_ = [[FakeKeystoneGlue class] instanceMethodForSelector:ids]; |
192 Method infoMethod_ = class_getInstanceMethod([KeystoneGlue class], ids); | 192 Method infoMethod_ = class_getInstanceMethod([KeystoneGlue class], ids); |
193 method_setImplementation(infoMethod_, newInfoImp_); | 193 method_setImplementation(infoMethod_, newInfoImp_); |
(...skipping 28 matching lines...) Expand all Loading... |
222 [glue stopTimer]; | 222 [glue stopTimer]; |
223 | 223 |
224 // Brief exercise of callbacks | 224 // Brief exercise of callbacks |
225 [glue addFakeRegistration]; | 225 [glue addFakeRegistration]; |
226 [glue checkForUpdate]; | 226 [glue checkForUpdate]; |
227 [glue installUpdate]; | 227 [glue installUpdate]; |
228 ASSERT_TRUE([glue confirmCallbacks]); | 228 ASSERT_TRUE([glue confirmCallbacks]); |
229 } | 229 } |
230 | 230 |
231 } // namespace | 231 } // namespace |
OLD | NEW |