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

Side by Side Diff: chrome/browser/cocoa/about_ipc_controller_unittest.mm

Issue 402066: Moved a whole pile of unittests over to CocoaTest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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/browser/app_controller_mac.mm ('k') | chrome/browser/cocoa/about_window_controller.h » ('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 #import <Cocoa/Cocoa.h> 5 #import <Cocoa/Cocoa.h>
6 6
7 #import "base/scoped_nsobject.h" 7 #import "base/scoped_nsobject.h"
8 #import "chrome/browser/cocoa/about_ipc_controller.h" 8 #import "chrome/browser/cocoa/about_ipc_controller.h"
9 #include "chrome/browser/cocoa/browser_test_helper.h" 9 #include "chrome/browser/cocoa/browser_test_helper.h"
10 #include "chrome/browser/cocoa/cocoa_test_helper.h" 10 #include "chrome/browser/cocoa/cocoa_test_helper.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 #include "testing/platform_test.h" 12 #include "testing/platform_test.h"
13 13
14 #if defined(IPC_MESSAGE_LOG_ENABLED) 14 #if defined(IPC_MESSAGE_LOG_ENABLED)
15 15
16 namespace { 16 namespace {
17 17
18 class AboutIPCControllerTest : public PlatformTest { 18 class AboutIPCControllerTest : public CocoaTest {
19 CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc...
20 }; 19 };
21 20
22 TEST_F(AboutIPCControllerTest, TestFilter) { 21 TEST_F(AboutIPCControllerTest, TestFilter) {
23 scoped_nsobject<AboutIPCController> controller( 22 AboutIPCController* controller = [[AboutIPCController alloc] init];
24 [[AboutIPCController alloc] init]); 23 EXPECT_TRUE([controller window]); // force nib load.
25 [controller window]; // force nib load.
26 IPC::LogData data; 24 IPC::LogData data;
27 25
28 // Make sure generic names do NOT get filtered. 26 // Make sure generic names do NOT get filtered.
29 std::wstring names[] = { L"PluginProcessingIsMyLife", 27 std::wstring names[] = { L"PluginProcessingIsMyLife",
30 L"ViewMsgFoo", 28 L"ViewMsgFoo",
31 L"NPObjectHell" }; 29 L"NPObjectHell" };
32 for (unsigned int i = 0; i < arraysize(names); i++) { 30 for (size_t i = 0; i < arraysize(names); i++) {
33 data.message_name = names[i]; 31 data.message_name = names[i];
34 scoped_nsobject<CocoaLogData> cdata([[CocoaLogData alloc] 32 scoped_nsobject<CocoaLogData> cdata([[CocoaLogData alloc]
35 initWithLogData:data]); 33 initWithLogData:data]);
36 EXPECT_FALSE([controller filterOut:cdata.get()]); 34 EXPECT_FALSE([controller filterOut:cdata.get()]);
37 } 35 }
38 36
39 // Flip a checkbox, see it filtered, flip back, all is fine. 37 // Flip a checkbox, see it filtered, flip back, all is fine.
40 data.message_name = L"ViewMsgFoo"; 38 data.message_name = L"ViewMsgFoo";
41 scoped_nsobject<CocoaLogData> cdata([[CocoaLogData alloc] 39 scoped_nsobject<CocoaLogData> cdata([[CocoaLogData alloc]
42 initWithLogData:data]); 40 initWithLogData:data]);
43 [controller setDisplayViewMessages:NO]; 41 [controller setDisplayViewMessages:NO];
44 EXPECT_TRUE([controller filterOut:cdata.get()]); 42 EXPECT_TRUE([controller filterOut:cdata.get()]);
45 [controller setDisplayViewMessages:YES]; 43 [controller setDisplayViewMessages:YES];
46 EXPECT_FALSE([controller filterOut:cdata.get()]); 44 EXPECT_FALSE([controller filterOut:cdata.get()]);
45 [controller close];
47 } 46 }
48 47
49 } // namespace 48 } // namespace
50 49
51 #endif // IPC_MESSAGE_LOG_ENABLED 50 #endif // IPC_MESSAGE_LOG_ENABLED
OLDNEW
« no previous file with comments | « chrome/browser/app_controller_mac.mm ('k') | chrome/browser/cocoa/about_window_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698