OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 10 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 #endif | 76 #endif |
77 } | 77 } |
78 | 78 |
79 virtual void SetUpOnMainThread() OVERRIDE { | 79 virtual void SetUpOnMainThread() OVERRIDE { |
80 base::FilePath path = GetTestFilePath("", ""); | 80 base::FilePath path = GetTestFilePath("", ""); |
81 BrowserThread::PostTask( | 81 BrowserThread::PostTask( |
82 BrowserThread::IO, FROM_HERE, base::Bind(&SetUrlRequestMock, path)); | 82 BrowserThread::IO, FROM_HERE, base::Bind(&SetUrlRequestMock, path)); |
83 } | 83 } |
84 | 84 |
85 static void LoadAndWaitInWindow(Shell* window, const GURL& url) { | 85 static void LoadAndWaitInWindow(Shell* window, const GURL& url) { |
86 string16 expected_title(ASCIIToUTF16("OK")); | 86 base::string16 expected_title(ASCIIToUTF16("OK")); |
87 TitleWatcher title_watcher(window->web_contents(), expected_title); | 87 TitleWatcher title_watcher(window->web_contents(), expected_title); |
88 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 88 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
89 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("plugin_not_found")); | 89 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("plugin_not_found")); |
90 NavigateToURL(window, url); | 90 NavigateToURL(window, url); |
91 string16 title = title_watcher.WaitAndGetTitle(); | 91 base::string16 title = title_watcher.WaitAndGetTitle(); |
92 if (title == ASCIIToUTF16("plugin_not_found")) { | 92 if (title == ASCIIToUTF16("plugin_not_found")) { |
93 const testing::TestInfo* const test_info = | 93 const testing::TestInfo* const test_info = |
94 testing::UnitTest::GetInstance()->current_test_info(); | 94 testing::UnitTest::GetInstance()->current_test_info(); |
95 VLOG(0) << "PluginTest." << test_info->name() | 95 VLOG(0) << "PluginTest." << test_info->name() |
96 << " not running because plugin not installed."; | 96 << " not running because plugin not installed."; |
97 } else { | 97 } else { |
98 EXPECT_EQ(expected_title, title); | 98 EXPECT_EQ(expected_title, title); |
99 } | 99 } |
100 } | 100 } |
101 | 101 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 #if defined(OS_WIN) | 164 #if defined(OS_WIN) |
165 // Tests if a plugin executing a self deleting script in the context of | 165 // Tests if a plugin executing a self deleting script in the context of |
166 // a synchronous mouseup works correctly. | 166 // a synchronous mouseup works correctly. |
167 // This was never ported to Mac. The only thing remaining is to make | 167 // This was never ported to Mac. The only thing remaining is to make |
168 // SimulateMouseClick get to Mac plugins, currently it doesn't work. | 168 // SimulateMouseClick get to Mac plugins, currently it doesn't work. |
169 IN_PROC_BROWSER_TEST_F(PluginTest, | 169 IN_PROC_BROWSER_TEST_F(PluginTest, |
170 MAYBE(SelfDeletePluginInvokeInSynchronousMouseUp)) { | 170 MAYBE(SelfDeletePluginInvokeInSynchronousMouseUp)) { |
171 NavigateToURL(shell(), GetURL("execute_script_delete_in_mouse_up.html")); | 171 NavigateToURL(shell(), GetURL("execute_script_delete_in_mouse_up.html")); |
172 | 172 |
173 string16 expected_title(ASCIIToUTF16("OK")); | 173 base::string16 expected_title(ASCIIToUTF16("OK")); |
174 TitleWatcher title_watcher(shell()->web_contents(), expected_title); | 174 TitleWatcher title_watcher(shell()->web_contents(), expected_title); |
175 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 175 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
176 SimulateMouseClick(shell()->web_contents(), 0, | 176 SimulateMouseClick(shell()->web_contents(), 0, |
177 blink::WebMouseEvent::ButtonLeft); | 177 blink::WebMouseEvent::ButtonLeft); |
178 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 178 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
179 } | 179 } |
180 #endif | 180 #endif |
181 | 181 |
182 // Flaky, http://crbug.com/302274. | 182 // Flaky, http://crbug.com/302274. |
183 #if defined(OS_MACOSX) | 183 #if defined(OS_MACOSX) |
(...skipping 10 matching lines...) Expand all Loading... |
194 } | 194 } |
195 | 195 |
196 // Tests if a plugin executing a self deleting script using Invoke with | 196 // Tests if a plugin executing a self deleting script using Invoke with |
197 // a modal dialog showing works without crashing or hanging | 197 // a modal dialog showing works without crashing or hanging |
198 // Disabled, flakily exceeds timeout, http://crbug.com/46257. | 198 // Disabled, flakily exceeds timeout, http://crbug.com/46257. |
199 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(SelfDeletePluginInvokeAlert)) { | 199 IN_PROC_BROWSER_TEST_F(PluginTest, MAYBE(SelfDeletePluginInvokeAlert)) { |
200 // Navigate asynchronously because if we waitd until it completes, there's a | 200 // Navigate asynchronously because if we waitd until it completes, there's a |
201 // race condition where the alert can come up before we start watching for it. | 201 // race condition where the alert can come up before we start watching for it. |
202 shell()->LoadURL(GetURL("self_delete_plugin_invoke_alert.html")); | 202 shell()->LoadURL(GetURL("self_delete_plugin_invoke_alert.html")); |
203 | 203 |
204 string16 expected_title(ASCIIToUTF16("OK")); | 204 base::string16 expected_title(ASCIIToUTF16("OK")); |
205 TitleWatcher title_watcher(shell()->web_contents(), expected_title); | 205 TitleWatcher title_watcher(shell()->web_contents(), expected_title); |
206 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 206 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
207 | 207 |
208 WaitForAppModalDialog(shell()); | 208 WaitForAppModalDialog(shell()); |
209 | 209 |
210 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 210 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
211 } | 211 } |
212 | 212 |
213 // Test passing arguments to a plugin. | 213 // Test passing arguments to a plugin. |
214 // crbug.com/306318 | 214 // crbug.com/306318 |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 } | 401 } |
402 | 402 |
403 #if defined(OS_MACOSX) | 403 #if defined(OS_MACOSX) |
404 // Test is flaky, see http://crbug.com/134515. | 404 // Test is flaky, see http://crbug.com/134515. |
405 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_PluginConvertPointTest) { | 405 IN_PROC_BROWSER_TEST_F(PluginTest, DISABLED_PluginConvertPointTest) { |
406 gfx::Rect bounds(50, 50, 400, 400); | 406 gfx::Rect bounds(50, 50, 400, 400); |
407 SetWindowBounds(shell()->window(), bounds); | 407 SetWindowBounds(shell()->window(), bounds); |
408 | 408 |
409 NavigateToURL(shell(), GetURL("convert_point.html")); | 409 NavigateToURL(shell(), GetURL("convert_point.html")); |
410 | 410 |
411 string16 expected_title(ASCIIToUTF16("OK")); | 411 base::string16 expected_title(ASCIIToUTF16("OK")); |
412 TitleWatcher title_watcher(shell()->web_contents(), expected_title); | 412 TitleWatcher title_watcher(shell()->web_contents(), expected_title); |
413 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); | 413 title_watcher.AlsoWaitForTitle(ASCIIToUTF16("FAIL")); |
414 // TODO(stuartmorgan): When the automation system supports sending clicks, | 414 // TODO(stuartmorgan): When the automation system supports sending clicks, |
415 // change the test to trigger on mouse-down rather than window focus. | 415 // change the test to trigger on mouse-down rather than window focus. |
416 | 416 |
417 // TODO: is this code still needed? It was here when it used to run in | 417 // TODO: is this code still needed? It was here when it used to run in |
418 // browser_tests. | 418 // browser_tests. |
419 //static_cast<WebContentsDelegate*>(shell())-> | 419 //static_cast<WebContentsDelegate*>(shell())-> |
420 // ActivateContents(shell()->web_contents()); | 420 // ActivateContents(shell()->web_contents()); |
421 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 421 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 ResourceDispatcherHostDelegate* old_delegate = | 548 ResourceDispatcherHostDelegate* old_delegate = |
549 ResourceDispatcherHostImpl::Get()->delegate(); | 549 ResourceDispatcherHostImpl::Get()->delegate(); |
550 ResourceDispatcherHostImpl::Get()->SetDelegate(&test_delegate); | 550 ResourceDispatcherHostImpl::Get()->SetDelegate(&test_delegate); |
551 LoadAndWait(url); | 551 LoadAndWait(url); |
552 test_delegate.WaitForPluginRequest(); | 552 test_delegate.WaitForPluginRequest(); |
553 ASSERT_TRUE(test_delegate.found_cookie()); | 553 ASSERT_TRUE(test_delegate.found_cookie()); |
554 ResourceDispatcherHostImpl::Get()->SetDelegate(old_delegate); | 554 ResourceDispatcherHostImpl::Get()->SetDelegate(old_delegate); |
555 } | 555 } |
556 | 556 |
557 } // namespace content | 557 } // namespace content |
OLD | NEW |