Flush gcda (code coverage) files manually in iOS Platform Test.

iOS 7 does not call any code at the "end" of an app so flushing should
be performed manually.

BUG=392265

Review URL: https://codereview.chromium.org/375033002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282195 0039d316-1c4b-4281-b951-d872f2087c98
parent 69e4cb03
// Copyright 2014 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.
extern "C" void __gcov_flush();
namespace coverage_util {
void FlushCoverageDataIfNecessary() {
#if defined(ENABLE_TEST_CODE_COVERAGE)
__gcov_flush();
#endif
}
} // namespace coverage_util
// Copyright 2014 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 TESTING_COVERAGE_UTIL_IOS_H_
#define TESTING_COVERAGE_UTIL_IOS_H_
namespace coverage_util {
// Flushes .gcda coverage files if ENABLE_TEST_CODE_COVERAGE is defined. iOS 7
// does not call any code at the "end" of an app so flushing should be
// performed manually.
void FlushCoverageDataIfNecessary();
} // namespace coverage_util
#endif // TESTING_COVERAGE_UTIL_IOS_H_
......@@ -66,7 +66,6 @@
'sources': [
'gtest_mac.h',
'gtest_mac.mm',
'platform_test_mac.mm'
],
'link_settings': {
'libraries': [
......@@ -74,6 +73,11 @@
],
},
}],
['OS == "mac"', {
'sources': [
'platform_test_mac.mm',
],
}],
['OS == "ios"', {
'dependencies' : [
'<(DEPTH)/testing/iossim/iossim.gyp:iossim#host',
......@@ -105,6 +109,11 @@
}],
],
},
'sources': [
'coverage_util_ios.cc',
'coverage_util_ios.h',
'platform_test_ios.mm',
],
}],
['OS=="ios" and asan==1', {
'direct_dependent_settings': {
......
// Copyright 2014 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 "platform_test.h"
#import <Foundation/Foundation.h>
#include "coverage_util_ios.h"
PlatformTest::PlatformTest()
: pool_([[NSAutoreleasePool alloc] init]) {
}
PlatformTest::~PlatformTest() {
[pool_ release];
coverage_util::FlushCoverageDataIfNecessary();
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment