automation_provider_unittest.cc revision c407dc5cd9bdc5668497f21b26b09d988ab439de
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
3// found in the LICENSE file.
4
5#include "chrome/browser/automation/chrome_frame_automation_provider.h"
6#include "ipc/ipc_message.h"
7#include "testing/gmock/include/gmock/gmock.h"
8#include "testing/gtest/include/gtest/gtest.h"
9
10class MockChromeFrameAutomationProvider
11    : public ChromeFrameAutomationProvider {
12 public:
13  explicit MockChromeFrameAutomationProvider(Profile* profile)
14      : ChromeFrameAutomationProvider(profile) {}
15
16  virtual ~MockChromeFrameAutomationProvider() {}
17
18  MOCK_METHOD1(OnUnhandledMessage,
19               void (const IPC::Message& message));  // NOLINT
20};
21
22TEST(AutomationProviderTest, TestInvalidChromeFrameMessage) {
23  IPC::Message bad_msg(1, -1, IPC::Message::PRIORITY_NORMAL);
24
25  scoped_refptr<MockChromeFrameAutomationProvider>
26      mock(new MockChromeFrameAutomationProvider(NULL));
27
28  EXPECT_CALL(*mock, OnUnhandledMessage(testing::Property(&IPC::Message::type,
29                                        -1))).Times(1);
30  mock->OnMessageReceived(bad_msg);
31}
32
33