| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "remote_desktop_browsertest.h" | 5 #include "remote_desktop_browsertest.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
| 9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 GetKeyValuesFromChar(c, &code, &keyboard_code, &shift); | 274 GetKeyValuesFromChar(c, &code, &keyboard_code, &shift); |
| 275 ASSERT_TRUE(code != NULL); | 275 ASSERT_TRUE(code != NULL); |
| 276 SimulateKeyPressWithCode(keyboard_code, code, false, shift, false, false); | 276 SimulateKeyPressWithCode(keyboard_code, code, false, shift, false, false); |
| 277 } | 277 } |
| 278 | 278 |
| 279 void RemoteDesktopBrowserTest::SimulateStringInput(const std::string& input) { | 279 void RemoteDesktopBrowserTest::SimulateStringInput(const std::string& input) { |
| 280 for (size_t i = 0; i < input.length(); ++i) | 280 for (size_t i = 0; i < input.length(); ++i) |
| 281 SimulateCharInput(input[i]); | 281 SimulateCharInput(input[i]); |
| 282 } | 282 } |
| 283 | 283 |
| 284 void RemoteDesktopBrowserTest::SimulateMouseClickAt(int x, int y) { |
| 285 SimulateMouseClickAt(0, WebKit::WebMouseEvent::ButtonLeft, x, y); |
| 286 } |
| 287 |
| 288 void RemoteDesktopBrowserTest::SimulateMouseClickAt( |
| 289 int modifiers, WebKit::WebMouseEvent::Button button, int x, int y) { |
| 290 ExecuteScript( |
| 291 "var clientPluginElement = " |
| 292 "document.getElementById('session-client-plugin');" |
| 293 "var clientPluginRect = clientPluginElement.getBoundingClientRect();"); |
| 294 |
| 295 int top = ExecuteScriptAndExtractInt("clientPluginRect.top"); |
| 296 int left = ExecuteScriptAndExtractInt("clientPluginRect.left"); |
| 297 int width = ExecuteScriptAndExtractInt("clientPluginRect.width"); |
| 298 int height = ExecuteScriptAndExtractInt("clientPluginRect.height"); |
| 299 |
| 300 ASSERT_GT(x, 0); |
| 301 ASSERT_LT(x, width); |
| 302 ASSERT_GT(y, 0); |
| 303 ASSERT_LT(y, height); |
| 304 |
| 305 content::SimulateMouseClickAt( |
| 306 browser()->tab_strip_model()->GetActiveWebContents(), |
| 307 modifiers, |
| 308 button, |
| 309 gfx::Point(left + x, top + y)); |
| 310 } |
| 311 |
| 284 void RemoteDesktopBrowserTest::Install() { | 312 void RemoteDesktopBrowserTest::Install() { |
| 285 // TODO(weitaosu): add support for unpacked extension (the v2 app needs it). | 313 // TODO(weitaosu): add support for unpacked extension (the v2 app needs it). |
| 286 if (!NoInstall()) { | 314 if (!NoInstall()) { |
| 287 VerifyChromotingLoaded(false); | 315 VerifyChromotingLoaded(false); |
| 288 InstallChromotingApp(); | 316 InstallChromotingApp(); |
| 289 } | 317 } |
| 290 | 318 |
| 291 VerifyChromotingLoaded(true); | 319 VerifyChromotingLoaded(true); |
| 292 } | 320 } |
| 293 | 321 |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 oauth_redirect_url_ = "chrome-extension://" + ChromotingID(); | 568 oauth_redirect_url_ = "chrome-extension://" + ChromotingID(); |
| 541 oauth_redirect_url_ += "/oauth2_callback.html?"; | 569 oauth_redirect_url_ += "/oauth2_callback.html?"; |
| 542 oauth_redirect_url_ += url.query(); | 570 oauth_redirect_url_ += url.query(); |
| 543 return false; | 571 return false; |
| 544 } | 572 } |
| 545 | 573 |
| 546 return url.spec() == "about:blank" || url == Chromoting_Main_URL(); | 574 return url.spec() == "about:blank" || url == Chromoting_Main_URL(); |
| 547 } | 575 } |
| 548 | 576 |
| 549 } // namespace remoting | 577 } // namespace remoting |
| OLD | NEW |