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 "apps/ui/native_app_window.h" | 5 #include "apps/ui/native_app_window.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/apps/app_browsertest_util.h" | 9 #include "chrome/browser/apps/app_browsertest_util.h" |
10 #include "chrome/browser/automation/automation_util.h" | 10 #include "chrome/browser/automation/automation_util.h" |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 *persistent_partition_contents2 = source6->GetWebContents(); | 442 *persistent_partition_contents2 = source6->GetWebContents(); |
443 } | 443 } |
444 if (persistent_partition_contents3) { | 444 if (persistent_partition_contents3) { |
445 *persistent_partition_contents3 = source7->GetWebContents(); | 445 *persistent_partition_contents3 = source7->GetWebContents(); |
446 } | 446 } |
447 } | 447 } |
448 | 448 |
449 void ExecuteScriptWaitForTitle(content::WebContents* web_contents, | 449 void ExecuteScriptWaitForTitle(content::WebContents* web_contents, |
450 const char* script, | 450 const char* script, |
451 const char* title) { | 451 const char* title) { |
452 string16 expected_title(ASCIIToUTF16(title)); | 452 base::string16 expected_title(ASCIIToUTF16(title)); |
453 string16 error_title(ASCIIToUTF16("error")); | 453 base::string16 error_title(ASCIIToUTF16("error")); |
454 | 454 |
455 content::TitleWatcher title_watcher(web_contents, expected_title); | 455 content::TitleWatcher title_watcher(web_contents, expected_title); |
456 title_watcher.AlsoWaitForTitle(error_title); | 456 title_watcher.AlsoWaitForTitle(error_title); |
457 EXPECT_TRUE(content::ExecuteScript(web_contents, script)); | 457 EXPECT_TRUE(content::ExecuteScript(web_contents, script)); |
458 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 458 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
459 } | 459 } |
460 | 460 |
461 // Handles |request| by serving a redirect response. | 461 // Handles |request| by serving a redirect response. |
462 static scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler( | 462 static scoped_ptr<net::test_server::HttpResponse> RedirectResponseHandler( |
463 const std::string& path, | 463 const std::string& path, |
(...skipping 1068 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1532 ASSERT_TRUE(StartEmbeddedTestServer()); | 1532 ASSERT_TRUE(StartEmbeddedTestServer()); |
1533 content::WebContents* guest_web_contents = LoadGuest( | 1533 content::WebContents* guest_web_contents = LoadGuest( |
1534 "/extensions/platform_apps/web_view/speech/guest.html", | 1534 "/extensions/platform_apps/web_view/speech/guest.html", |
1535 "web_view/speech"); | 1535 "web_view/speech"); |
1536 ASSERT_TRUE(guest_web_contents); | 1536 ASSERT_TRUE(guest_web_contents); |
1537 | 1537 |
1538 // Click on the guest (center of the WebContents), the guest is rendered in a | 1538 // Click on the guest (center of the WebContents), the guest is rendered in a |
1539 // way that this will trigger clicking on speech recognition input mic. | 1539 // way that this will trigger clicking on speech recognition input mic. |
1540 SimulateMouseClick(guest_web_contents, 0, blink::WebMouseEvent::ButtonLeft); | 1540 SimulateMouseClick(guest_web_contents, 0, blink::WebMouseEvent::ButtonLeft); |
1541 | 1541 |
1542 string16 expected_title(ASCIIToUTF16("PASSED")); | 1542 base::string16 expected_title(ASCIIToUTF16("PASSED")); |
1543 string16 error_title(ASCIIToUTF16("FAILED")); | 1543 base::string16 error_title(ASCIIToUTF16("FAILED")); |
1544 content::TitleWatcher title_watcher(guest_web_contents, expected_title); | 1544 content::TitleWatcher title_watcher(guest_web_contents, expected_title); |
1545 title_watcher.AlsoWaitForTitle(error_title); | 1545 title_watcher.AlsoWaitForTitle(error_title); |
1546 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); | 1546 EXPECT_EQ(expected_title, title_watcher.WaitAndGetTitle()); |
1547 } | 1547 } |
1548 | 1548 |
1549 // Flaky on Windows. http://crbug.com/303966 | 1549 // Flaky on Windows. http://crbug.com/303966 |
1550 #if defined(OS_WIN) | 1550 #if defined(OS_WIN) |
1551 #define MAYBE_TearDownTest DISABLED_TearDownTest | 1551 #define MAYBE_TearDownTest DISABLED_TearDownTest |
1552 #else | 1552 #else |
1553 #define MAYBE_TearDownTest TearDownTest | 1553 #define MAYBE_TearDownTest TearDownTest |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1824 pepper_plugin.append(FILE_PATH_LITERAL(";application/x-ppapi-tests")); | 1824 pepper_plugin.append(FILE_PATH_LITERAL(";application/x-ppapi-tests")); |
1825 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, | 1825 command_line->AppendSwitchNative(switches::kRegisterPepperPlugins, |
1826 pepper_plugin); | 1826 pepper_plugin); |
1827 } | 1827 } |
1828 }; | 1828 }; |
1829 | 1829 |
1830 IN_PROC_BROWSER_TEST_F(WebViewPluginTest, TestLoadPluginEvent) { | 1830 IN_PROC_BROWSER_TEST_F(WebViewPluginTest, TestLoadPluginEvent) { |
1831 TestHelper("testPluginLoadPermission", "web_view/shim", NO_TEST_SERVER); | 1831 TestHelper("testPluginLoadPermission", "web_view/shim", NO_TEST_SERVER); |
1832 } | 1832 } |
1833 #endif // defined(ENABLE_PLUGINS) | 1833 #endif // defined(ENABLE_PLUGINS) |
OLD | NEW |