OLD | NEW |
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/browser/browser_thread.h" | 5 #include "chrome/browser/browser_thread.h" |
6 #include "chrome/browser/automation/chrome_frame_automation_provider.h" | 6 #include "chrome/browser/automation/chrome_frame_automation_provider.h" |
| 7 #include "chrome/test/testing_browser_process.h" |
| 8 #include "chrome/test/testing_browser_process_test.h" |
7 #include "ipc/ipc_message.h" | 9 #include "ipc/ipc_message.h" |
8 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
10 | 12 |
11 class MockChromeFrameAutomationProvider | 13 class MockChromeFrameAutomationProvider |
12 : public ChromeFrameAutomationProvider { | 14 : public ChromeFrameAutomationProvider { |
13 public: | 15 public: |
14 explicit MockChromeFrameAutomationProvider(Profile* profile) | 16 explicit MockChromeFrameAutomationProvider(Profile* profile) |
15 : ChromeFrameAutomationProvider(profile) {} | 17 : ChromeFrameAutomationProvider(profile) {} |
16 | 18 |
17 virtual ~MockChromeFrameAutomationProvider() {} | 19 virtual ~MockChromeFrameAutomationProvider() {} |
18 | 20 |
19 MOCK_METHOD1(OnUnhandledMessage, | 21 MOCK_METHOD1(OnUnhandledMessage, |
20 void (const IPC::Message& message)); // NOLINT | 22 void (const IPC::Message& message)); // NOLINT |
21 }; | 23 }; |
22 | 24 |
23 TEST(AutomationProviderTest, TestInvalidChromeFrameMessage) { | 25 typedef TestingBrowserProcessTest AutomationProviderTest; |
| 26 |
| 27 TEST_F(AutomationProviderTest, TestInvalidChromeFrameMessage) { |
24 MessageLoop message_loop; | 28 MessageLoop message_loop; |
25 BrowserThread ui_thread(BrowserThread::UI, &message_loop); | 29 BrowserThread ui_thread(BrowserThread::UI, &message_loop); |
26 | 30 |
27 IPC::Message bad_msg(1, -1, IPC::Message::PRIORITY_NORMAL); | 31 IPC::Message bad_msg(1, -1, IPC::Message::PRIORITY_NORMAL); |
28 | 32 |
29 scoped_refptr<MockChromeFrameAutomationProvider> | 33 scoped_refptr<MockChromeFrameAutomationProvider> |
30 mock(new MockChromeFrameAutomationProvider(NULL)); | 34 mock(new MockChromeFrameAutomationProvider(NULL)); |
31 | 35 |
32 EXPECT_CALL(*mock, OnUnhandledMessage(testing::Property(&IPC::Message::type, | 36 EXPECT_CALL(*mock, OnUnhandledMessage(testing::Property(&IPC::Message::type, |
33 -1))).Times(1); | 37 -1))).Times(1); |
34 mock->OnMessageReceived(bad_msg); | 38 mock->OnMessageReceived(bad_msg); |
35 } | 39 } |
36 | 40 |
OLD | NEW |