Index: chrome/test/webdriver/server.cc |
=================================================================== |
--- chrome/test/webdriver/server.cc (revision 79141) |
+++ chrome/test/webdriver/server.cc (working copy) |
@@ -77,25 +77,8 @@ |
base::WaitableEvent* shutdown_event) { |
dispatcher->AddShutdown("/shutdown", shutdown_event); |
- dispatcher->Add<CreateSession>( "/session"); |
- dispatcher->Add<BackCommand>( "/session/*/back"); |
- dispatcher->Add<ExecuteCommand>( "/session/*/execute"); |
- dispatcher->Add<ForwardCommand>( "/session/*/forward"); |
- dispatcher->Add<SwitchFrameCommand>( "/session/*/frame"); |
- dispatcher->Add<RefreshCommand>( "/session/*/refresh"); |
- dispatcher->Add<SourceCommand>( "/session/*/source"); |
- dispatcher->Add<SpeedCommand>( "/session/*/speed"); |
- dispatcher->Add<TitleCommand>( "/session/*/title"); |
- dispatcher->Add<URLCommand>( "/session/*/url"); |
- dispatcher->Add<WindowCommand>( "/session/*/window"); |
- dispatcher->Add<WindowHandleCommand>( "/session/*/window_handle"); |
- dispatcher->Add<WindowHandlesCommand>("/session/*/window_handles"); |
- dispatcher->Add<ImplicitWaitCommand>( "/session/*/timeouts/implicit_wait"); |
+ dispatcher->Add<CreateSession>("/session"); |
- // Cookie functions. |
- dispatcher->Add<CookieCommand>( "/session/*/cookie"); |
- dispatcher->Add<NamedCookieCommand>("/session/*/cookie/*"); |
- |
// WebElement commands |
dispatcher->Add<FindOneElementCommand>( "/session/*/element"); |
dispatcher->Add<FindManyElementsCommand>("/session/*/elements"); |
@@ -124,6 +107,30 @@ |
dispatcher->Add<DragCommand>( "/session/*/element/*/drag"); |
dispatcher->Add<HoverCommand>("/session/*/element/*/hover"); |
+ // All session based commands should be listed after the element based |
+ // commands to avoid potential mapping conflicts from an overzealous |
+ // wildcard match. For example, /session/*/title maps to the handler to |
+ // fetch the page title. If mapped first, this would overwrite the handler |
+ // for /session/*/element/*/attribute/title, which should fetch the title |
+ // attribute of the element. |
+ dispatcher->Add<BackCommand>( "/session/*/back"); |
+ dispatcher->Add<ExecuteCommand>( "/session/*/execute"); |
+ dispatcher->Add<ForwardCommand>( "/session/*/forward"); |
+ dispatcher->Add<SwitchFrameCommand>( "/session/*/frame"); |
+ dispatcher->Add<RefreshCommand>( "/session/*/refresh"); |
+ dispatcher->Add<SourceCommand>( "/session/*/source"); |
+ dispatcher->Add<SpeedCommand>( "/session/*/speed"); |
+ dispatcher->Add<TitleCommand>( "/session/*/title"); |
+ dispatcher->Add<URLCommand>( "/session/*/url"); |
+ dispatcher->Add<WindowCommand>( "/session/*/window"); |
+ dispatcher->Add<WindowHandleCommand>( "/session/*/window_handle"); |
+ dispatcher->Add<WindowHandlesCommand>("/session/*/window_handles"); |
+ dispatcher->Add<ImplicitWaitCommand>( "/session/*/timeouts/implicit_wait"); |
+ |
+ // Cookie functions. |
+ dispatcher->Add<CookieCommand>( "/session/*/cookie"); |
+ dispatcher->Add<NamedCookieCommand>("/session/*/cookie/*"); |
+ |
// Commands that have not been implemented yet. We list these out explicitly |
// so that tests that attempt to use them fail with a meaningful error. |
dispatcher->SetNotImplemented("/session/*/execute_async"); |