| 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 gfx::Rect popup_bounds = popup_rwh->GetView()->GetViewBounds(); | 385 gfx::Rect popup_bounds = popup_rwh->GetView()->GetViewBounds(); |
| 386 | 386 |
| 387 content::RenderViewHost* embedder_rvh = | 387 content::RenderViewHost* embedder_rvh = |
| 388 GetFirstAppWindowWebContents()->GetRenderViewHost(); | 388 GetFirstAppWindowWebContents()->GetRenderViewHost(); |
| 389 gfx::Rect embedder_bounds = | 389 gfx::Rect embedder_bounds = |
| 390 embedder_rvh->GetWidget()->GetView()->GetViewBounds(); | 390 embedder_rvh->GetWidget()->GetView()->GetViewBounds(); |
| 391 gfx::Vector2d diff = popup_bounds.origin() - embedder_bounds.origin(); | 391 gfx::Vector2d diff = popup_bounds.origin() - embedder_bounds.origin(); |
| 392 LOG(INFO) << "DIFF: x = " << diff.x() << ", y = " << diff.y(); | 392 LOG(INFO) << "DIFF: x = " << diff.x() << ", y = " << diff.y(); |
| 393 | 393 |
| 394 const int left_spacing = 40 + padding.x(); // div.style.paddingLeft = 40px. | 394 const int left_spacing = 40 + padding.x(); // div.style.paddingLeft = 40px. |
| 395 // div.style.paddingTop = 50px + (input box height = 26px). | 395 // div.style.paddingTop = 60px + (input box height = 26px). |
| 396 const int top_spacing = 50 + 26 + padding.y(); | 396 const int top_spacing = 60 + 26 + padding.y(); |
| 397 | 397 |
| 398 // If the popup is placed within |threshold_px| of the expected position, | 398 // If the popup is placed within |threshold_px| of the expected position, |
| 399 // then we consider the test as a pass. | 399 // then we consider the test as a pass. |
| 400 const int threshold_px = 10; | 400 const int threshold_px = 10; |
| 401 | 401 |
| 402 EXPECT_LE(std::abs(diff.x() - left_spacing), threshold_px); | 402 EXPECT_LE(std::abs(diff.x() - left_spacing), threshold_px); |
| 403 EXPECT_LE(std::abs(diff.y() - top_spacing), threshold_px); | 403 EXPECT_LE(std::abs(diff.y() - top_spacing), threshold_px); |
| 404 | 404 |
| 405 // Close the popup. | 405 // Close the popup. |
| 406 content::SimulateKeyPress( | 406 content::SimulateKeyPress( |
| (...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1338 // this time. | 1338 // this time. |
| 1339 for (size_t i = 0; i < 4; ++i) | 1339 for (size_t i = 0; i < 4; ++i) |
| 1340 SendKeyPressToPlatformApp(ui::VKEY_TAB); | 1340 SendKeyPressToPlatformApp(ui::VKEY_TAB); |
| 1341 ExtensionTestMessageListener webview_button_not_focused_listener( | 1341 ExtensionTestMessageListener webview_button_not_focused_listener( |
| 1342 "WebViewInteractiveTest.WebViewButtonWasNotFocused", false); | 1342 "WebViewInteractiveTest.WebViewButtonWasNotFocused", false); |
| 1343 webview_button_not_focused_listener.set_failure_message( | 1343 webview_button_not_focused_listener.set_failure_message( |
| 1344 "WebViewInteractiveTest.WebViewButtonWasFocused"); | 1344 "WebViewInteractiveTest.WebViewButtonWasFocused"); |
| 1345 SendMessageToEmbedder("verify"); | 1345 SendMessageToEmbedder("verify"); |
| 1346 EXPECT_TRUE(webview_button_not_focused_listener.WaitUntilSatisfied()); | 1346 EXPECT_TRUE(webview_button_not_focused_listener.WaitUntilSatisfied()); |
| 1347 } | 1347 } |
| OLD | NEW |