diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-25 16:32:48 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-25 16:32:48 +0000 |
commit | d75faa8114fe821e65c2c3844729cf10d3c69088 (patch) | |
tree | f5e524fa7f16e167a24abff203a2543b5b763b71 | |
parent | 42fc3155c8fd9923bfe4f854bc9d6e67bb5cdb12 (diff) | |
download | chromium_src-d75faa8114fe821e65c2c3844729cf10d3c69088.zip chromium_src-d75faa8114fe821e65c2c3844729cf10d3c69088.tar.gz chromium_src-d75faa8114fe821e65c2c3844729cf10d3c69088.tar.bz2 |
Dump Keystone integration from Mac TestShell
Review URL: http://codereview.chromium.org/53042
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12455 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | webkit/tools/test_shell/mac/KeystoneGlue.h | 33 | ||||
-rw-r--r-- | webkit/tools/test_shell/mac/KeystoneGlue.m | 78 | ||||
-rwxr-xr-x | webkit/tools/test_shell/mac/keystone_install.sh | 51 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.gyp | 2 |
4 files changed, 0 insertions, 164 deletions
diff --git a/webkit/tools/test_shell/mac/KeystoneGlue.h b/webkit/tools/test_shell/mac/KeystoneGlue.h deleted file mode 100644 index 0ebc2f7..0000000 --- a/webkit/tools/test_shell/mac/KeystoneGlue.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef WEBKIT_TOOLS_TEST_SHELL_MAC_KEYSTONE_GLUE_H_ -#define WEBKIT_TOOLS_TEST_SHELL_MAC_KEYSTONE_GLUE_H_ - -#import <Foundation/Foundation.h> - -// KeystoneGlue is an adapter around the KSRegistration class, allowing it to -// be used without linking directly against its containing KeystoneRegistration -// framework. This is used in an environment where most builds (such as -// developer builds) don't want or need Keystone support and might not even -// have the framework available. Enabling Keystone support in an application -// that uses KeystoneGlue is as simple as dropping -// KeystoneRegistration.framework in the application's Frameworks directory -// and providing the relevant information in its Info.plist. KeystoneGlue -// requires that the KSUpdateURL key be set in the application's Info.plist, -// and that it contain a string identifying the update URL to be used by -// Keystone. - -@interface KeystoneGlue : NSObject - -// Load KeystoneRegistration.framework if present, call into it to register -// with Keystone, and set up periodic activity pings. -+ (void)registerWithKeystone; - -// Called periodically to announce activity by pinging the Keystone server. -+ (void)markActive:(NSTimer*)timer; - -@end - -#endif // WEBKIT_TOOLS_TEST_SHELL_MAC_KEYSTONE_GLUE_H_ diff --git a/webkit/tools/test_shell/mac/KeystoneGlue.m b/webkit/tools/test_shell/mac/KeystoneGlue.m deleted file mode 100644 index 87b470e..0000000 --- a/webkit/tools/test_shell/mac/KeystoneGlue.m +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#import "KeystoneGlue.h" - -// Provide declarations of the Keystone registration bits needed here. From -// KSRegistration.h. -typedef enum { kKSPathExistenceChecker } KSExistenceCheckerType; -@interface KSRegistration : NSObject -+ (id)registrationWithProductID:(NSString*)productID; -- (BOOL)registerWithVersion:(NSString*)version - existenceCheckerType:(KSExistenceCheckerType)xctype - existenceCheckerString:(NSString*)xc - serverURLString:(NSString*)serverURLString; -- (void)setActive; -@end - -@implementation KeystoneGlue - -// TODO(mmentovai): Determine if the app is writable, and don't register for -// updates if not - but keep the periodic activity pings. -+ (void)registerWithKeystone { - // Figure out who we are. - NSBundle* mainBundle = [NSBundle mainBundle]; - NSString* bundleIdentifier = [mainBundle bundleIdentifier]; - NSDictionary* infoDictionary = [mainBundle infoDictionary]; - NSString* url = [infoDictionary objectForKey:@"KSUpdateURL"]; - // TODO(mmentovai): The svn version serves our purposes for now, but it will - // likely be replaced. The key problem is that it does not monotonically - // increase for releases when considering svn branches and tags. For the - // purposes of TestShell, though, which will likely only ever survive in - // auto-updatable form in builds straight from the trunk, this is fine. - NSString* version = [infoDictionary objectForKey:@"SVNRevision"]; - if (!bundleIdentifier || !url || !version) { - // If parameters required for Keystone are missing, don't use it. - return; - } - - // Load the KeystoneRegistration framework bundle. - NSString* ksrPath = - [[mainBundle privateFrameworksPath] - stringByAppendingPathComponent:@"KeystoneRegistration.framework"]; - NSBundle* ksrBundle = [NSBundle bundleWithPath:ksrPath]; - [ksrBundle load]; - - // Harness the KSRegistration class. - Class ksrClass = [ksrBundle classNamed:@"KSRegistration"]; - KSRegistration* ksr = [ksrClass registrationWithProductID:bundleIdentifier]; - if (!ksr) { - // Strictly speaking, this isn't necessary, because it's harmless to send - // messages to nil. However, if there really isn't a - // KeystoneRegistration.framework or KSRegistration class, bailing out here - // avoids setting up the timer that will only be able to perform no-ops. - return; - } - - // Keystone will asynchronously handle installation and registration as - // needed. - [ksr registerWithVersion:version - existenceCheckerType:kKSPathExistenceChecker - existenceCheckerString:[mainBundle bundlePath] - serverURLString:url]; - - // Set up hourly activity pings. - [NSTimer scheduledTimerWithTimeInterval:60 * 60 // One hour - target:self - selector:@selector(markActive:) - userInfo:ksr - repeats:YES]; -} - -+ (void)markActive:(NSTimer*)timer { - KSRegistration* ksr = [timer userInfo]; - [ksr setActive]; -} - -@end diff --git a/webkit/tools/test_shell/mac/keystone_install.sh b/webkit/tools/test_shell/mac/keystone_install.sh deleted file mode 100755 index b2e42f6..0000000 --- a/webkit/tools/test_shell/mac/keystone_install.sh +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh - -# Copyright (c) 2009 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Called by the Keystone system to update the installed application with a new -# version from a disk image. - -set -e - -# The argument should be the disk image path. Make sure it exists. -if [ ! -d "${1}" ] ; then - exit 1 -fi - -# Who we are. -APP_NAME="Chromium TestShell.app" -SRC="${1}/${APP_NAME}" - -# Sanity, make sure that there's something to copy from. -if [ ! -d "${SRC}" ] ; then - exit 1 -fi - -# Figure out where we're going. -BUNDLE_ID=$(defaults read "${SRC}/Contents/Info" CFBundleIdentifier) -DEST=$(ksadmin -pP "${BUNDLE_ID}" | grep xc= | sed -E 's/.+path=(.+)>$/\1/g') - -# More sanity checking. -if [ -z "${SRC}" ] || [ -z "${DEST}" ] || [ ! -d $(dirname "${DEST}") ]; then - exit 1 -fi - -# This usage will preserve any changes the user made to the application name. -rsync -a --delete "${SRC}/" "${DEST}/" - -VERSION=$(defaults read "${DEST}/Contents/Info" SVNRevision) -URL=$(defaults read "${DEST}/Contents/Info" KSUpdateURL) - -# Notify LaunchServices. -/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister "${DEST}" - -# Notify Keystone. -ksadmin -P "${BUNDLE_ID}" \ - --version "${VERSION}" \ - --xcpath "${DEST}" \ - --url "${URL}" - -# Great success! -exit 0 diff --git a/webkit/tools/test_shell/test_shell.gyp b/webkit/tools/test_shell/test_shell.gyp index e5b66d5..db95ec0 100644 --- a/webkit/tools/test_shell/test_shell.gyp +++ b/webkit/tools/test_shell/test_shell.gyp @@ -26,8 +26,6 @@ 'sources': [ 'mac/DumpRenderTreePasteboard.h', 'mac/DumpRenderTreePasteboard.m', - 'mac/KeystoneGlue.h', - 'mac/KeystoneGlue.m', 'mac/test_shell_webview.h', 'mac/test_shell_webview.mm', 'mac/test_webview_delegate.mm', |