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