OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 The Chromium Authors. All rights reserved. | 2 * Copyright 2013 The Chromium Authors. All rights reserved. |
3 * Use of this source code is governed by a BSD-style license that can be | 3 * Use of this source code is governed by a BSD-style license that can be |
4 * found in the LICENSE file. | 4 * found in the LICENSE file. |
5 */ | 5 */ |
6 #include "chrome/browser/chromeos/extensions/virtual_keyboard_browsertest.h" | 6 #include "chrome/browser/chromeos/extensions/virtual_keyboard_browsertest.h" |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 input_method->ShowImeIfNeeded(); | 92 input_method->ShowImeIfNeeded(); |
93 } | 93 } |
94 | 94 |
95 content::RenderViewHost* VirtualKeyboardBrowserTest::GetKeyboardRenderViewHost( | 95 content::RenderViewHost* VirtualKeyboardBrowserTest::GetKeyboardRenderViewHost( |
96 const std::string& id) { | 96 const std::string& id) { |
97 ShowVirtualKeyboard(); | 97 ShowVirtualKeyboard(); |
98 GURL url = extensions::Extension::GetBaseURLFromExtensionId(id); | 98 GURL url = extensions::Extension::GetBaseURLFromExtensionId(id); |
99 scoped_ptr<content::RenderWidgetHostIterator> widgets( | 99 scoped_ptr<content::RenderWidgetHostIterator> widgets( |
100 content::RenderWidgetHost::GetRenderWidgetHosts()); | 100 content::RenderWidgetHost::GetRenderWidgetHosts()); |
101 while (content::RenderWidgetHost* widget = widgets->GetNextHost()) { | 101 while (content::RenderWidgetHost* widget = widgets->GetNextHost()) { |
102 if (widget->IsRenderView()) { | 102 content::RenderViewHost* view = content::RenderViewHost::From(widget); |
103 content::RenderViewHost* view = content::RenderViewHost::From(widget); | 103 if (view && url == view->GetSiteInstance()->GetSiteURL()) { |
104 if (url == view->GetSiteInstance()->GetSiteURL()) { | 104 content::WebContents* wc = content::WebContents::FromRenderViewHost(view); |
105 content::WebContents* wc = | 105 // Waits for virtual keyboard to load. |
106 content::WebContents::FromRenderViewHost(view); | 106 EXPECT_TRUE(content::WaitForLoadStop(wc)); |
107 // Waits for virtual keyboard to load. | 107 return view; |
108 EXPECT_TRUE(content::WaitForLoadStop(wc)); | |
109 return view; | |
110 } | |
111 } | 108 } |
112 } | 109 } |
113 LOG(ERROR) << "Extension not found:" << url; | 110 LOG(ERROR) << "Extension not found:" << url; |
114 return NULL; | 111 return NULL; |
115 } | 112 } |
116 | 113 |
117 void VirtualKeyboardBrowserTest::InjectJavascript(const base::FilePath& dir, | 114 void VirtualKeyboardBrowserTest::InjectJavascript(const base::FilePath& dir, |
118 const base::FilePath& file) { | 115 const base::FilePath& file) { |
119 base::FilePath path = ui_test_utils::GetTestFilePath(dir, file); | 116 base::FilePath path = ui_test_utils::GetTestFilePath(dir, file); |
120 std::string library_content; | 117 std::string library_content; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 bool success = false; | 184 bool success = false; |
188 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 185 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
189 browser_rvh, | 186 browser_rvh, |
190 "success ? verifyInput('a') : waitForInput('a');", | 187 "success ? verifyInput('a') : waitForInput('a');", |
191 &success)); | 188 &success)); |
192 ASSERT_TRUE(success); | 189 ASSERT_TRUE(success); |
193 } | 190 } |
194 | 191 |
195 // TODO(kevers|rsadam|bshe): Add UI tests for remaining virtual keyboard | 192 // TODO(kevers|rsadam|bshe): Add UI tests for remaining virtual keyboard |
196 // functionality. | 193 // functionality. |
OLD | NEW |