diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-06 22:45:14 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-06 22:45:14 +0000 |
commit | 4eaf265da17a1dc133067296ab9a16b519f63bac (patch) | |
tree | 65cf7ca979067bef262230a66047dbc3b757a0c8 /chrome/test/automation/automation_messages.h | |
parent | a80edd4bf4e8f692fd02a7108a490d7921cc53b9 (diff) | |
download | chromium_src-4eaf265da17a1dc133067296ab9a16b519f63bac.zip chromium_src-4eaf265da17a1dc133067296ab9a16b519f63bac.tar.gz chromium_src-4eaf265da17a1dc133067296ab9a16b519f63bac.tar.bz2 |
Handle review comments form previous change. Also, use enum types and not int in IPC messages to make things clearer.
Review URL: http://codereview.chromium.org/20140
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9351 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/automation/automation_messages.h')
-rw-r--r-- | chrome/test/automation/automation_messages.h | 114 |
1 files changed, 110 insertions, 4 deletions
diff --git a/chrome/test/automation/automation_messages.h b/chrome/test/automation/automation_messages.h index d4e916c..289cf5e5 100644 --- a/chrome/test/automation/automation_messages.h +++ b/chrome/test/automation/automation_messages.h @@ -8,14 +8,120 @@ #include <string> #include "base/basictypes.h" +#include "chrome/browser/tab_contents/navigation_entry.h" +#include "chrome/browser/tab_contents/security_style.h" #include "chrome/common/ipc_message_utils.h" +#include "chrome/test/automation/automation_constants.h" -enum AutomationMsg_NavigationResponseValues { - AUTOMATION_MSG_NAVIGATION_ERROR = 0, - AUTOMATION_MSG_NAVIGATION_SUCCESS, - AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED, +namespace IPC { + +template <> +struct ParamTraits<AutomationMsg_NavigationResponseValues> { + typedef AutomationMsg_NavigationResponseValues param_type; + static void Write(Message* m, const param_type& p) { + m->WriteInt(p); + } + static bool Read(const Message* m, void** iter, param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<AutomationMsg_NavigationResponseValues>(type); + return true; + } + static void Log(const param_type& p, std::wstring* l) { + std::wstring control; + switch (p) { + case AUTOMATION_MSG_NAVIGATION_ERROR: + control = L"AUTOMATION_MSG_NAVIGATION_ERROR"; + break; + case AUTOMATION_MSG_NAVIGATION_SUCCESS: + control = L"AUTOMATION_MSG_NAVIGATION_SUCCESS"; + break; + case AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED: + control = L"AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED"; + break; + default: + control = L"UNKNOWN"; + break; + } + + LogParam(control, l); + } +}; + +template <> +struct ParamTraits<SecurityStyle> { + typedef SecurityStyle param_type; + static void Write(Message* m, const param_type& p) { + m->WriteInt(p); + } + static bool Read(const Message* m, void** iter, param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<SecurityStyle>(type); + return true; + } + static void Log(const param_type& p, std::wstring* l) { + std::wstring control; + switch (p) { + case SECURITY_STYLE_UNKNOWN: + control = L"SECURITY_STYLE_UNKNOWN"; + break; + case SECURITY_STYLE_UNAUTHENTICATED: + control = L"SECURITY_STYLE_UNAUTHENTICATED"; + break; + case SECURITY_STYLE_AUTHENTICATION_BROKEN: + control = L"SECURITY_STYLE_AUTHENTICATION_BROKEN"; + break; + case SECURITY_STYLE_AUTHENTICATED: + control = L"SECURITY_STYLE_AUTHENTICATED"; + break; + default: + control = L"UNKNOWN"; + break; + } + + LogParam(control, l); + } }; +template <> +struct ParamTraits<NavigationEntry::PageType> { + typedef NavigationEntry::PageType param_type; + static void Write(Message* m, const param_type& p) { + m->WriteInt(p); + } + static bool Read(const Message* m, void** iter, param_type* p) { + int type; + if (!m->ReadInt(iter, &type)) + return false; + *p = static_cast<NavigationEntry::PageType>(type); + return true; + } + static void Log(const param_type& p, std::wstring* l) { + std::wstring control; + switch (p) { + case NavigationEntry::NORMAL_PAGE: + control = L"NORMAL_PAGE"; + break; + case NavigationEntry::ERROR_PAGE: + control = L"ERROR_PAGE"; + break; + case NavigationEntry::INTERSTITIAL_PAGE: + control = L"INTERSTITIAL_PAGE"; + break; + default: + control = L"UNKNOWN"; + break; + } + + LogParam(control, l); + } +}; + +} // namespace IPC + #define MESSAGES_INTERNAL_FILE \ "chrome/test/automation/automation_messages_internal.h" #include "chrome/common/ipc_message_macros.h" |