diff options
author | stoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-13 16:02:26 +0000 |
---|---|---|
committer | stoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-13 16:02:26 +0000 |
commit | 11b6e60b413fe6b596cbf08f78e689a360faeb61 (patch) | |
tree | 04d332597120edd9a87f42efab62f3b1d7f4f8f4 /chrome_frame/external_tab_test.cc | |
parent | 18004a3331147f8f84ad8a21caa2ce695d75c28a (diff) | |
download | chromium_src-11b6e60b413fe6b596cbf08f78e689a360faeb61.zip chromium_src-11b6e60b413fe6b596cbf08f78e689a360faeb61.tar.gz chromium_src-11b6e60b413fe6b596cbf08f78e689a360faeb61.tar.bz2 |
Review URL: http://codereview.chromium.org/3685006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62407 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/external_tab_test.cc')
-rw-r--r-- | chrome_frame/external_tab_test.cc | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/chrome_frame/external_tab_test.cc b/chrome_frame/external_tab_test.cc new file mode 100644 index 0000000..f34c169 --- /dev/null +++ b/chrome_frame/external_tab_test.cc @@ -0,0 +1,95 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome_frame/external_tab.h" +// #include "base/tracked.h" +// #include "base/task.h" +// #include "base/waitable_event.h" + +#include "chrome/test/automation/automation_messages.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "testing/gmock/include/gmock/gmock.h" + + + +// DISABLE_RUNNABLE_METHOD_REFCOUNT(ExternalTabProxy); +// DISABLE_RUNNABLE_METHOD_REFCOUNT(UIDelegate); + + +struct MockUIDelegate : public UIDelegate { + MOCK_METHOD2(OnNavigationStateChanged, void(int flags, + const IPC::NavigationInfo& nav_info)); + MOCK_METHOD1(OnUpdateTargetUrl, void(const std::wstring& new_target_url)); + MOCK_METHOD3(OnExtensionInstalled, void(const FilePath& path, void* user_data, + AutomationMsg_ExtensionResponseValues response)); + MOCK_METHOD1(OnLoad, void(const GURL& url)); + MOCK_METHOD3(OnMessageFromChromeFrame, void(const std::string& message, + const std::string& origin, const std::string& target)); + MOCK_METHOD3(OnHandleContextMenu, void(HANDLE menu_handle, int align_flags, + const IPC::ContextMenuParams& params)); + MOCK_METHOD1(OnHandleAccelerator, void(const MSG& accel_message)); + MOCK_METHOD1(OnTabbedOut, void(bool reverse)); + MOCK_METHOD1(OnGoToHistoryOffset, void(int offset)); + MOCK_METHOD3(OnOpenURL, void(const GURL& url_to_open, const GURL& referrer, + int open_disposition)); +}; + +struct MockProxy : public ChromeProxy { + MOCK_METHOD1(RemoveBrowsingData, void(int remove_mask)); + MOCK_METHOD3(InstallExtension, void(ChromeProxyDelegate* delegate, + const FilePath& crx_path, SyncMessageContext* ctx)); + MOCK_METHOD3(LoadExtension, void(ChromeProxyDelegate* delegate, + const FilePath& path, SyncMessageContext* ctx)); + MOCK_METHOD2(GetEnabledExtensions, void(ChromeProxyDelegate* delegate, + SyncMessageContext* ctx)); + MOCK_METHOD1(SetProxyConfig, void(const std::string& json_encoded_settings)); + + MOCK_METHOD2(CreateTab, void(ChromeProxyDelegate* delegate, + const IPC::ExternalTabSettings& settings)); + MOCK_METHOD3(ConnectTab, void(ChromeProxyDelegate* delegate, HWND hwnd, + uint64 cookie)); + MOCK_METHOD1(BlockTab, void(uint64 cookie)); + + MOCK_METHOD4(Tab_PostMessage, void(int tab, const std::string& message, + const std::string& origin, const std::string& target)); + MOCK_METHOD1(Tab_Reload, void(int tab)); + MOCK_METHOD1(Tab_Stop, void(int tab)); + MOCK_METHOD1(Tab_SaveAs, void(int tab)); + MOCK_METHOD1(Tab_Print, void(int tab)); + MOCK_METHOD1(Tab_Cut, void(int tab)); + MOCK_METHOD1(Tab_Copy, void(int tab)); + MOCK_METHOD1(Tab_Paste, void(int tab)); + MOCK_METHOD1(Tab_SelectAll, void(int tab)); + MOCK_METHOD5(Tab_Find, void(int tab, const string16& search_string, + FindInPageDirection forward, FindInPageCase match_case, bool find_next)); + MOCK_METHOD2(Tab_MenuCommand, void(int tab, int selected_command)); + + MOCK_METHOD2(Tab_Zoom, void(int tab, PageZoom::Function zoom_level)); + MOCK_METHOD2(Tab_FontSize, void(int tab, AutomationPageFontSize font_size)); + MOCK_METHOD3(Tab_SetInitialFocus, void(int tab, bool reverse, + bool restore_focus_to_view)); + MOCK_METHOD1(Tab_SetParentWindow, void(int tab)); + MOCK_METHOD1(Tab_Resize, void(int tab)); + MOCK_METHOD2(Tab_ProcessAccelerator, void(int tab, const MSG& msg)); + + // Misc. + MOCK_METHOD1(Tab_OnHostMoved, void(int tab)); + MOCK_METHOD1(Tab_RunUnloadHandlers, void(int tab)); + MOCK_METHOD2(Tab_SetEnableExtensionAutomation, void(int tab, + const std::vector<std::string>& functions_enabled)); + MOCK_METHOD3(Tab_Navigate, void(int tab, const GURL& url, + const GURL& referrer)); + MOCK_METHOD2(Tab_OverrideEncoding, void(int tab, const char* encoding)); + + private: + MOCK_METHOD1(Init, void(const ProxyParams& params)); + MOCK_METHOD1(AddDelegate, int(ChromeProxyDelegate* delegate)); + MOCK_METHOD1(RemoveDelegate, int(ChromeProxyDelegate* delegate)); +}; + +TEST(ExternalTabProxy, Simple1) { + MockUIDelegate ui; + MockProxy proxy; + ExternalTabProxy tab; +} |