| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_nsobject.h" | 7 #import "base/mac/scoped_nsobject.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #import "chrome/browser/ui/cocoa/about_ipc_controller.h" | 9 #import "chrome/browser/ui/cocoa/about_ipc_controller.h" |
| 10 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 10 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 11 #include "content/public/test/test_browser_thread.h" | 11 #include "content/public/test/test_browser_thread.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "testing/platform_test.h" | 13 #include "testing/platform_test.h" |
| 14 | 14 |
| 15 #if defined(IPC_MESSAGE_LOG_ENABLED) | 15 #if defined(IPC_MESSAGE_LOG_ENABLED) |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 39 AboutIPCController* controller = [[AboutIPCController alloc] init]; | 39 AboutIPCController* controller = [[AboutIPCController alloc] init]; |
| 40 EXPECT_TRUE([controller window]); // force nib load. | 40 EXPECT_TRUE([controller window]); // force nib load. |
| 41 IPC::LogData data; | 41 IPC::LogData data; |
| 42 | 42 |
| 43 // Make sure generic names do NOT get filtered. | 43 // Make sure generic names do NOT get filtered. |
| 44 std::string names[] = { "PluginProcessingIsMyLife", | 44 std::string names[] = { "PluginProcessingIsMyLife", |
| 45 "ViewMsgFoo", | 45 "ViewMsgFoo", |
| 46 "NPObjectHell" }; | 46 "NPObjectHell" }; |
| 47 for (size_t i = 0; i < arraysize(names); i++) { | 47 for (size_t i = 0; i < arraysize(names); i++) { |
| 48 data.message_name = names[i]; | 48 data.message_name = names[i]; |
| 49 scoped_nsobject<CocoaLogData> cdata([[CocoaLogData alloc] | 49 base::scoped_nsobject<CocoaLogData> cdata( |
| 50 initWithLogData:data]); | 50 [[CocoaLogData alloc] initWithLogData:data]); |
| 51 EXPECT_FALSE([controller filterOut:cdata.get()]); | 51 EXPECT_FALSE([controller filterOut:cdata.get()]); |
| 52 } | 52 } |
| 53 | 53 |
| 54 // Flip a checkbox, see it filtered, flip back, all is fine. | 54 // Flip a checkbox, see it filtered, flip back, all is fine. |
| 55 data.message_name = "ViewMsgFoo"; | 55 data.message_name = "ViewMsgFoo"; |
| 56 scoped_nsobject<CocoaLogData> cdata([[CocoaLogData alloc] | 56 base::scoped_nsobject<CocoaLogData> cdata( |
| 57 initWithLogData:data]); | 57 [[CocoaLogData alloc] initWithLogData:data]); |
| 58 [controller setDisplayViewMessages:NO]; | 58 [controller setDisplayViewMessages:NO]; |
| 59 EXPECT_TRUE([controller filterOut:cdata.get()]); | 59 EXPECT_TRUE([controller filterOut:cdata.get()]); |
| 60 [controller setDisplayViewMessages:YES]; | 60 [controller setDisplayViewMessages:YES]; |
| 61 EXPECT_FALSE([controller filterOut:cdata.get()]); | 61 EXPECT_FALSE([controller filterOut:cdata.get()]); |
| 62 [controller close]; | 62 [controller close]; |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace | 65 } // namespace |
| 66 | 66 |
| 67 #endif // IPC_MESSAGE_LOG_ENABLED | 67 #endif // IPC_MESSAGE_LOG_ENABLED |
| OLD | NEW |