| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/memory/singleton.h" | 6 #include "base/memory/singleton.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 RenderWidgetHostImpl* guest_widget_host = | 903 RenderWidgetHostImpl* guest_widget_host = |
| 904 RenderWidgetHostImpl::From(guest_contents->GetRenderViewHost()); | 904 RenderWidgetHostImpl::From(guest_contents->GetRenderViewHost()); |
| 905 | 905 |
| 906 SkBitmap expected_bitmap; | 906 SkBitmap expected_bitmap; |
| 907 expected_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 50, 60); | 907 expected_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 50, 60); |
| 908 expected_bitmap.allocPixels(); | 908 expected_bitmap.allocPixels(); |
| 909 expected_bitmap.eraseARGB(255, 255, 0, 0); // #f00 | 909 expected_bitmap.eraseARGB(255, 255, 0, 0); // #f00 |
| 910 bool result = false; | 910 bool result = false; |
| 911 while (!result) { | 911 while (!result) { |
| 912 base::RunLoop loop; | 912 base::RunLoop loop; |
| 913 guest_widget_host->CopyFromBackingStore(gfx::Rect(), | 913 guest_widget_host->CopyFromBackingStore( |
| 914 gfx::Rect(), |
| 914 guest_widget_host->GetView()->GetViewBounds().size(), | 915 guest_widget_host->GetView()->GetViewBounds().size(), |
| 915 base::Bind(&CompareSkBitmapAndRun, loop.QuitClosure(), expected_bitmap, | 916 base::Bind(&CompareSkBitmapAndRun, |
| 916 &result)); | 917 loop.QuitClosure(), |
| 918 expected_bitmap, |
| 919 &result), |
| 920 SkBitmap::kARGB_8888_Config); |
| 917 loop.Run(); | 921 loop.Run(); |
| 918 } | 922 } |
| 919 } | 923 } |
| 920 | 924 |
| 921 // This test exercises the following scenario: | 925 // This test exercises the following scenario: |
| 922 // 1. An <input> in guest has focus. | 926 // 1. An <input> in guest has focus. |
| 923 // 2. User takes focus to embedder by clicking e.g. an <input> in embedder. | 927 // 2. User takes focus to embedder by clicking e.g. an <input> in embedder. |
| 924 // 3. User brings back the focus directly to the <input> in #1. | 928 // 3. User brings back the focus directly to the <input> in #1. |
| 925 // | 929 // |
| 926 // Now we need to make sure TextInputTypeChange fires properly for the guest's | 930 // Now we need to make sure TextInputTypeChange fires properly for the guest's |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1073 scoped_ptr<base::Value> value = | 1077 scoped_ptr<base::Value> value = |
| 1074 content::ExecuteScriptAndGetValue( | 1078 content::ExecuteScriptAndGetValue( |
| 1075 guest_rvh, "document.getElementById('input1').value"); | 1079 guest_rvh, "document.getElementById('input1').value"); |
| 1076 std::string actual_value; | 1080 std::string actual_value; |
| 1077 ASSERT_TRUE(value->GetAsString(&actual_value)); | 1081 ASSERT_TRUE(value->GetAsString(&actual_value)); |
| 1078 EXPECT_EQ(base::UTF16ToUTF8(expected_value), actual_value); | 1082 EXPECT_EQ(base::UTF16ToUTF8(expected_value), actual_value); |
| 1079 } | 1083 } |
| 1080 } | 1084 } |
| 1081 | 1085 |
| 1082 } // namespace content | 1086 } // namespace content |
| OLD | NEW |