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