httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j..@apache.org
Subject svn commit: r1591622 [33/33] - in /httpd/mod_spdy/trunk: ./ base/ base/base.xcodeproj/ base/metrics/ build/ build/all.xcodeproj/ build/build_util.xcodeproj/ build/install.xcodeproj/ build/internal/ build/linux/ build/mac/ build/util/ build/win/ install...
Date Thu, 01 May 2014 11:43:45 GMT
Propchange: httpd/mod_spdy/trunk/testing/gmock_mutant.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: httpd/mod_spdy/trunk/testing/gtest_mac.mm
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/testing/gtest_mac.mm?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/testing/gtest_mac.mm (added)
+++ httpd/mod_spdy/trunk/testing/gtest_mac.mm Thu May  1 11:43:36 2014
@@ -0,0 +1,53 @@
+// Copyright (c) 2010 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 "gtest_mac.h"
+
+#include <gtest/internal/gtest-port.h>
+#include <gtest/internal/gtest-string.h>
+#include <gtest/gtest.h>
+
+#ifdef GTEST_OS_MAC
+
+#import <Foundation/Foundation.h>
+
+namespace testing {
+namespace internal {
+
+// This overloaded version allows comparison between ObjC objects that conform
+// to the NSObject protocol. Used to implement {ASSERT|EXPECT}_EQ().
+GTEST_API_ AssertionResult CmpHelperNSEQ(const char* expected_expression,
+                                         const char* actual_expression,
+                                         id<NSObject> expected,
+                                         id<NSObject> actual) {
+  if (expected == actual || [expected isEqual:actual]) {
+    return AssertionSuccess();
+  }
+  return EqFailure(expected_expression,
+                   actual_expression,
+                   String([[expected description] UTF8String]),
+                   String([[actual description] UTF8String]),
+                   false);
+}
+
+// This overloaded version allows comparison between ObjC objects that conform
+// to the NSObject protocol. Used to implement {ASSERT|EXPECT}_NE().
+GTEST_API_ AssertionResult CmpHelperNSNE(const char* expected_expression,
+                                         const char* actual_expression,
+                                         id<NSObject> expected,
+                                         id<NSObject> actual) {
+  if (expected != actual && ![expected isEqual:actual]) {
+    return AssertionSuccess();
+  }
+  Message msg;
+  msg << "Expected: (" << expected_expression << ") != (" << actual_expression
+      << "), actual: " << String([[expected description] UTF8String])
+      << " vs " << String([[actual description] UTF8String]);
+  return AssertionFailure(msg);
+}
+
+}  // namespace internal
+}  // namespace testing
+
+#endif  // GTEST_OS_MAC

Added: httpd/mod_spdy/trunk/testing/gtest_mac_unittest.mm
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/testing/gtest_mac_unittest.mm?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/testing/gtest_mac_unittest.mm (added)
+++ httpd/mod_spdy/trunk/testing/gtest_mac_unittest.mm Thu May  1 11:43:36 2014
@@ -0,0 +1,57 @@
+// Copyright (c) 2012 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.
+
+// Note that while this file is in testing/ and tests GTest macros, it is built
+// as part of Chromium's unit_tests target because the project does not build
+// or run GTest's internal test suite.
+
+#import "testing/gtest_mac.h"
+
+#import <Foundation/Foundation.h>
+
+#include "base/mac/scoped_nsautorelease_pool.h"
+#include "testing/gtest/include/gtest/internal/gtest-port.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(GTestMac, ExpectNSEQ) {
+  base::mac::ScopedNSAutoreleasePool pool;
+
+  EXPECT_NSEQ(@"a", @"a");
+
+  NSString* s1 = [NSString stringWithUTF8String:"a"];
+  NSString* s2 = @"a";
+  EXPECT_NE(s1, s2);
+  EXPECT_NSEQ(s1, s2);
+}
+
+TEST(GTestMac, AssertNSEQ) {
+  base::mac::ScopedNSAutoreleasePool pool;
+
+  NSNumber* n1 = [NSNumber numberWithInt:42];
+  NSNumber* n2 = [NSNumber numberWithInt:42];
+  EXPECT_NE(n1, n2);
+  ASSERT_NSEQ(n1, n2);
+}
+
+TEST(GTestMac, ExpectNSNE) {
+  base::mac::ScopedNSAutoreleasePool pool;
+
+  EXPECT_NSNE([NSNumber numberWithInt:2], [NSNumber numberWithInt:42]);
+}
+
+TEST(GTestMac, AssertNSNE) {
+  base::mac::ScopedNSAutoreleasePool pool;
+
+  ASSERT_NSNE(@"a", @"b");
+}
+
+TEST(GTestMac, ExpectNSNil) {
+  base::mac::ScopedNSAutoreleasePool pool;
+
+  EXPECT_NSEQ(nil, nil);
+  EXPECT_NSNE(nil, @"a");
+  EXPECT_NSNE(@"a", nil);
+
+  // TODO(shess): Test that EXPECT_NSNE(nil, nil) fails.
+}

Added: httpd/mod_spdy/trunk/testing/test_env.py
URL: http://svn.apache.org/viewvc/httpd/mod_spdy/trunk/testing/test_env.py?rev=1591622&view=auto
==============================================================================
--- httpd/mod_spdy/trunk/testing/test_env.py (added)
+++ httpd/mod_spdy/trunk/testing/test_env.py Thu May  1 11:43:36 2014
@@ -0,0 +1,48 @@
+#!/usr/bin/env python
+# Copyright (c) 2012 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.
+
+"""Sets environment variables needed to run a chromium unit test."""
+
+import os
+import subprocess
+import sys
+
+# This is hardcoded to be src/ relative to this script.
+ROOT_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+
+
+def fix_python_path(cmd):
+  """Returns the fixed command line to call the right python executable."""
+  out = cmd[:]
+  if out[0] == 'python':
+    out[0] = sys.executable
+  elif out[0].endswith('.py'):
+    out.insert(0, sys.executable)
+  return out
+
+
+def run_executable(cmd, env):
+  """Runs an executable with:
+    - environment variable LANGUAGE to en_US.UTF-8.
+    - Reuses sys.executable automatically.
+  """
+  # Many tests assume a English interface...
+  env['LANGUAGE'] = 'en_US.UTF-8'
+  # Ensure paths are correctly separated on windows.
+  cmd[0] = cmd[0].replace('/', os.path.sep)
+  cmd = fix_python_path(cmd)
+  try:
+    return subprocess.call(cmd, env=env)
+  except OSError:
+    print >> sys.stderr, 'Failed to start %s' % cmd
+    raise
+
+
+def main():
+  return run_executable(sys.argv[1:], os.environ.copy())
+
+
+if __name__ == "__main__":
+  sys.exit(main())

Propchange: httpd/mod_spdy/trunk/testing/test_env.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: httpd/mod_spdy/trunk/testing/test_env.py
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message