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

Side by Side Diff: chrome/common/child_process_logging_mac_unittest.mm

Issue 7849011: Refactor Mac crash key reporting - move to base/mac/crash_logging.{h,mm} (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix review comments Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/child_process_logging_mac.mm ('k') | chrome/common/mac/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/common/child_process_logging.h" 5 #include "chrome/common/child_process_logging.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/mac/crash_logging.h"
10 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/platform_test.h" 12 #include "testing/platform_test.h"
12 13
13 typedef PlatformTest ChildProcessLoggingTest; 14 typedef PlatformTest ChildProcessLoggingTest;
14 15
15 namespace { 16 namespace {
16 17
17 // Class to mock breakpad's setkeyvalue/clearkeyvalue functions needed for 18 // Class to mock breakpad's setkeyvalue/clearkeyvalue functions needed for
18 // SetActiveRendererURLImpl. 19 // SetActiveRendererURLImpl.
19 // The Keys are stored in a static dictionary and methods are provided to 20 // The Keys are stored in a static dictionary and methods are provided to
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 // static 82 // static
82 NSMutableDictionary* MockBreakpadKeyValueStore::dict; 83 NSMutableDictionary* MockBreakpadKeyValueStore::dict;
83 84
84 } // namespace 85 } // namespace
85 86
86 // Call through to SetActiveURLImpl using the functions from 87 // Call through to SetActiveURLImpl using the functions from
87 // MockBreakpadKeyValueStore. 88 // MockBreakpadKeyValueStore.
88 void SetActiveURLWithMock(const GURL& url) { 89 void SetActiveURLWithMock(const GURL& url) {
89 using child_process_logging::SetActiveURLImpl; 90 using child_process_logging::SetActiveURLImpl;
90 91
91 SetCrashKeyValueFuncPtr setFunc = MockBreakpadKeyValueStore::SetKeyValue; 92 base::mac::SetCrashKeyValueFuncPtr setFunc =
92 ClearCrashKeyValueFuncPtr clearFunc = 93 MockBreakpadKeyValueStore::SetKeyValue;
94 base::mac::ClearCrashKeyValueFuncPtr clearFunc =
93 MockBreakpadKeyValueStore::ClearKeyValue; 95 MockBreakpadKeyValueStore::ClearKeyValue;
94 96
95 SetActiveURLImpl(url, setFunc, clearFunc); 97 SetActiveURLImpl(url, setFunc, clearFunc);
96 } 98 }
97 99
98 TEST_F(ChildProcessLoggingTest, TestUrlSplitting) { 100 TEST_F(ChildProcessLoggingTest, TestUrlSplitting) {
99 using child_process_logging::kMaxNumCrashURLChunks; 101 using child_process_logging::kMaxNumCrashURLChunks;
100 using child_process_logging::kMaxNumURLChunkValueLength; 102 using child_process_logging::kMaxNumURLChunkValueLength;
101 103
102 const std::string short_url("http://abc/"); 104 const std::string short_url("http://abc/");
(...skipping 29 matching lines...) Expand all
132 EXPECT_EQ(mock.CountDictionaryEntries(), 0); 134 EXPECT_EQ(mock.CountDictionaryEntries(), 0);
133 135
134 136
135 // Check that overflow works correctly. 137 // Check that overflow works correctly.
136 SetActiveURLWithMock(GURL(overflow_url.c_str())); 138 SetActiveURLWithMock(GURL(overflow_url.c_str()));
137 EXPECT_TRUE(mock.VerifyDictionaryContents( 139 EXPECT_TRUE(mock.VerifyDictionaryContents(
138 overflow_url.substr(0, max_num_chars_stored_in_dump))); 140 overflow_url.substr(0, max_num_chars_stored_in_dump)));
139 SetActiveURLWithMock(GURL()); 141 SetActiveURLWithMock(GURL());
140 EXPECT_EQ(mock.CountDictionaryEntries(), 0); 142 EXPECT_EQ(mock.CountDictionaryEntries(), 0);
141 } 143 }
OLDNEW
« no previous file with comments | « chrome/common/child_process_logging_mac.mm ('k') | chrome/common/mac/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698