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/memory/scoped_nsobject.h" |
| 8 #include "base/message_loop.h" |
8 #import "chrome/browser/ui/cocoa/about_ipc_controller.h" | 9 #import "chrome/browser/ui/cocoa/about_ipc_controller.h" |
9 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 10 #include "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 11 #include "content/test/test_browser_thread.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
11 #include "testing/platform_test.h" | 13 #include "testing/platform_test.h" |
12 | 14 |
13 #if defined(IPC_MESSAGE_LOG_ENABLED) | 15 #if defined(IPC_MESSAGE_LOG_ENABLED) |
14 | 16 |
15 namespace { | 17 namespace { |
16 | 18 |
17 class AboutIPCControllerTest : public CocoaTest { | 19 class AboutIPCControllerTest : public CocoaTest { |
| 20 public: |
| 21 virtual void SetUp() { |
| 22 CocoaTest::SetUp(); |
| 23 ui_message_loop_.reset(new MessageLoopForUI()); |
| 24 ui_thread_.reset(new content::TestBrowserThread(content::BrowserThread::UI, |
| 25 MessageLoop::current())); |
| 26 } |
| 27 |
| 28 virtual void TearDown() { |
| 29 CocoaTest::TearDown(); |
| 30 ui_thread_.reset(NULL); |
| 31 } |
| 32 |
| 33 private: |
| 34 scoped_ptr<MessageLoopForUI> ui_message_loop_; |
| 35 scoped_ptr<content::TestBrowserThread> ui_thread_; |
18 }; | 36 }; |
19 | 37 |
20 TEST_F(AboutIPCControllerTest, TestFilter) { | 38 TEST_F(AboutIPCControllerTest, TestFilter) { |
21 AboutIPCController* controller = [[AboutIPCController alloc] init]; | 39 AboutIPCController* controller = [[AboutIPCController alloc] init]; |
22 EXPECT_TRUE([controller window]); // force nib load. | 40 EXPECT_TRUE([controller window]); // force nib load. |
23 IPC::LogData data; | 41 IPC::LogData data; |
24 | 42 |
25 // Make sure generic names do NOT get filtered. | 43 // Make sure generic names do NOT get filtered. |
26 std::string names[] = { "PluginProcessingIsMyLife", | 44 std::string names[] = { "PluginProcessingIsMyLife", |
27 "ViewMsgFoo", | 45 "ViewMsgFoo", |
(...skipping 12 matching lines...) Expand all Loading... |
40 [controller setDisplayViewMessages:NO]; | 58 [controller setDisplayViewMessages:NO]; |
41 EXPECT_TRUE([controller filterOut:cdata.get()]); | 59 EXPECT_TRUE([controller filterOut:cdata.get()]); |
42 [controller setDisplayViewMessages:YES]; | 60 [controller setDisplayViewMessages:YES]; |
43 EXPECT_FALSE([controller filterOut:cdata.get()]); | 61 EXPECT_FALSE([controller filterOut:cdata.get()]); |
44 [controller close]; | 62 [controller close]; |
45 } | 63 } |
46 | 64 |
47 } // namespace | 65 } // namespace |
48 | 66 |
49 #endif // IPC_MESSAGE_LOG_ENABLED | 67 #endif // IPC_MESSAGE_LOG_ENABLED |
OLD | NEW |