| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/location.h" | 7 #include "base/location.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 gfx::Rect popup_bounds = popup_rwh->GetView()->GetViewBounds(); | 386 gfx::Rect popup_bounds = popup_rwh->GetView()->GetViewBounds(); |
| 387 | 387 |
| 388 content::RenderViewHost* embedder_rvh = | 388 content::RenderViewHost* embedder_rvh = |
| 389 GetFirstAppWindowWebContents()->GetRenderViewHost(); | 389 GetFirstAppWindowWebContents()->GetRenderViewHost(); |
| 390 gfx::Rect embedder_bounds = | 390 gfx::Rect embedder_bounds = |
| 391 embedder_rvh->GetWidget()->GetView()->GetViewBounds(); | 391 embedder_rvh->GetWidget()->GetView()->GetViewBounds(); |
| 392 gfx::Vector2d diff = popup_bounds.origin() - embedder_bounds.origin(); | 392 gfx::Vector2d diff = popup_bounds.origin() - embedder_bounds.origin(); |
| 393 LOG(INFO) << "DIFF: x = " << diff.x() << ", y = " << diff.y(); | 393 LOG(INFO) << "DIFF: x = " << diff.x() << ", y = " << diff.y(); |
| 394 | 394 |
| 395 const int left_spacing = 40 + padding.x(); // div.style.paddingLeft = 40px. | 395 const int left_spacing = 40 + padding.x(); // div.style.paddingLeft = 40px. |
| 396 // div.style.paddingTop = 50px + (input box height = 26px). | 396 // div.style.paddingTop = 60px + (input box height = 26px). |
| 397 const int top_spacing = 50 + 26 + padding.y(); | 397 const int top_spacing = 60 + 26 + padding.y(); |
| 398 | 398 |
| 399 // If the popup is placed within |threshold_px| of the expected position, | 399 // If the popup is placed within |threshold_px| of the expected position, |
| 400 // then we consider the test as a pass. | 400 // then we consider the test as a pass. |
| 401 const int threshold_px = 10; | 401 const int threshold_px = 10; |
| 402 | 402 |
| 403 EXPECT_LE(std::abs(diff.x() - left_spacing), threshold_px); | 403 EXPECT_LE(std::abs(diff.x() - left_spacing), threshold_px); |
| 404 EXPECT_LE(std::abs(diff.y() - top_spacing), threshold_px); | 404 EXPECT_LE(std::abs(diff.y() - top_spacing), threshold_px); |
| 405 | 405 |
| 406 // Close the popup. | 406 // Close the popup. |
| 407 content::SimulateKeyPress( | 407 content::SimulateKeyPress( |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 // this time. | 1328 // this time. |
| 1329 for (size_t i = 0; i < 4; ++i) | 1329 for (size_t i = 0; i < 4; ++i) |
| 1330 SendKeyPressToPlatformApp(ui::VKEY_TAB); | 1330 SendKeyPressToPlatformApp(ui::VKEY_TAB); |
| 1331 ExtensionTestMessageListener webview_button_not_focused_listener( | 1331 ExtensionTestMessageListener webview_button_not_focused_listener( |
| 1332 "WebViewInteractiveTest.WebViewButtonWasNotFocused", false); | 1332 "WebViewInteractiveTest.WebViewButtonWasNotFocused", false); |
| 1333 webview_button_not_focused_listener.set_failure_message( | 1333 webview_button_not_focused_listener.set_failure_message( |
| 1334 "WebViewInteractiveTest.WebViewButtonWasFocused"); | 1334 "WebViewInteractiveTest.WebViewButtonWasFocused"); |
| 1335 SendMessageToEmbedder("verify"); | 1335 SendMessageToEmbedder("verify"); |
| 1336 EXPECT_TRUE(webview_button_not_focused_listener.WaitUntilSatisfied()); | 1336 EXPECT_TRUE(webview_button_not_focused_listener.WaitUntilSatisfied()); |
| 1337 } | 1337 } |
| OLD | NEW |