summaryrefslogtreecommitdiffstats
path: root/content/test
diff options
context:
space:
mode:
authorhayato@chromium.org <hayato@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-01 06:45:50 +0000
committerhayato@chromium.org <hayato@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-01 06:45:50 +0000
commit62df0a016209f927a61b76cf85f98c68aeea141f (patch)
tree82e5496428285c4a40203bb95e24d201b97e3f35 /content/test
parent08bfdd6d84eba3f87af54ab14a761d0000f76da5 (diff)
downloadchromium_src-62df0a016209f927a61b76cf85f98c68aeea141f.zip
chromium_src-62df0a016209f927a61b76cf85f98c68aeea141f.tar.gz
chromium_src-62df0a016209f927a61b76cf85f98c68aeea141f.tar.bz2
Revert 112249 - [Mac] Move ScopedSendingEvent from content/common/mac to base/mac.
Also merge content/ MockCrControlApp into base/ MockCrApp. BUG=102224 Review URL: http://codereview.chromium.org/8724004 TBR=shess@chromium.org Review URL: http://codereview.chromium.org/8762020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@112411 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/test')
-rw-r--r--content/test/content_test_suite.cc2
-rw-r--r--content/test/mock_chrome_application_mac.h32
-rw-r--r--content/test/mock_chrome_application_mac.mm28
3 files changed, 62 insertions, 0 deletions
diff --git a/content/test/content_test_suite.cc b/content/test/content_test_suite.cc
index 7a87809..c67f10a 100644
--- a/content/test/content_test_suite.cc
+++ b/content/test/content_test_suite.cc
@@ -17,6 +17,7 @@
#if defined(OS_MACOSX)
#include "base/mac/scoped_nsautorelease_pool.h"
+#include "content/test/mock_chrome_application_mac.h"
#endif
namespace {
@@ -67,6 +68,7 @@ ContentTestSuite::~ContentTestSuite() {
void ContentTestSuite::Initialize() {
#if defined(OS_MACOSX)
base::mac::ScopedNSAutoreleasePool autorelease_pool;
+ mock_cr_app::RegisterMockCrControlApp();
#endif
base::TestSuite::Initialize();
diff --git a/content/test/mock_chrome_application_mac.h b/content/test/mock_chrome_application_mac.h
new file mode 100644
index 0000000..c068962
--- /dev/null
+++ b/content/test/mock_chrome_application_mac.h
@@ -0,0 +1,32 @@
+// Copyright (c) 2011 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 CONTENT_TEST_MOCK_CHROME_APPLICATION_MAC_H_
+#define CONTENT_TEST_MOCK_CHROME_APPLICATION_MAC_H_
+#pragma once
+
+#if defined(__OBJC__)
+
+#import <AppKit/AppKit.h>
+
+#include "content/common/mac/scoped_sending_event.h"
+
+// Mock implementation supporting CrAppControlProtocol. Can be used
+// in tests using ScopedSendingEvent to deal with nested message
+// loops. Also implements CrAppProtocol so can be used as a
+// replacement for MockCrApp (in base/).
+@interface MockCrControlApp : NSApplication<CrAppControlProtocol> {
+ @private
+ BOOL isHandlingSendEvent_;
+}
+@end
+
+#endif // __OBJC__
+
+// To be used to instantiate MockCrControlApp from C++ code.
+namespace mock_cr_app {
+void RegisterMockCrControlApp();
+} // namespace mock_cr_app
+
+#endif // CONTENT_TEST_MOCK_CHROME_APPLICATION_MAC_H_
diff --git a/content/test/mock_chrome_application_mac.mm b/content/test/mock_chrome_application_mac.mm
new file mode 100644
index 0000000..a5d4c0c
--- /dev/null
+++ b/content/test/mock_chrome_application_mac.mm
@@ -0,0 +1,28 @@
+// Copyright (c) 2011 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.
+
+#include "content/test/mock_chrome_application_mac.h"
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+@implementation MockCrControlApp
+
+- (BOOL)isHandlingSendEvent {
+ return isHandlingSendEvent_;
+}
+
+- (void)setHandlingSendEvent:(BOOL)handlingSendEvent {
+ isHandlingSendEvent_ = handlingSendEvent;
+}
+
+@end
+
+namespace mock_cr_app {
+
+void RegisterMockCrControlApp() {
+ NSApplication* app = [MockCrControlApp sharedApplication];
+ ASSERT_TRUE([app conformsToProtocol:@protocol(CrAppControlProtocol)]);
+}
+
+} // namespace mock_cr_app