Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Side by Side Diff: testing/coverage_util_ios.mm

Issue 2789433004: Add tools for code coverage support in iOS. (Closed)
Patch Set: Rebased Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « testing/coverage_util_ios.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #import <Foundation/Foundation.h>
6
7 #import "testing/gtest/ios_enable_coverage.h"
8
9 #if !defined(NDEBUG) && BUILDFLAG(IOS_ENABLE_COVERAGE)
10 extern "C" void __llvm_profile_set_filename(const char* name);
11 #endif
12
13 namespace coverage_util {
14
15 void ConfigureCoverageReportPath() {
16 #if !defined(NDEBUG) && BUILDFLAG(IOS_ENABLE_COVERAGE)
17 static dispatch_once_t once_token;
18 dispatch_once(&once_token, ^{
19 // Writes the profraw file to the Documents directory, where the app has
20 // write rights.
21 NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,
22 NSUserDomainMask, YES);
23 NSString* documents_directory = [paths firstObject];
24 NSString* file_name = [documents_directory
25 stringByAppendingPathComponent:@"coverage.profraw"];
26
27 // For documentation, see:
28 // http://clang.llvm.org/docs/SourceBasedCodeCoverage.html
29 __llvm_profile_set_filename(
30 [file_name cStringUsingEncoding:NSUTF8StringEncoding]);
31
32 // Print the path for easier retrieval.
33 NSLog(@"Coverage data at %@.", file_name);
34 });
35 #endif // !defined(NDEBUG) && BUILDFLAG(IOS_ENABLE_COVERAGE)
36 }
37
38 } // namespace coverage_util
OLDNEW
« no previous file with comments | « testing/coverage_util_ios.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698