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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "apps/launcher.h" | 9 #include "apps/launcher.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 } | 607 } |
608 | 608 |
609 #if !defined(OS_WIN) | 609 #if !defined(OS_WIN) |
610 // Tests that launch data is sent through for a file with an empty extension if | 610 // Tests that launch data is sent through for a file with an empty extension if |
611 // a handler accepts "". | 611 // a handler accepts "". |
612 IN_PROC_BROWSER_TEST_F(PlatformAppWithFileBrowserTest, | 612 IN_PROC_BROWSER_TEST_F(PlatformAppWithFileBrowserTest, |
613 LaunchWithFileEmptyExtension) { | 613 LaunchWithFileEmptyExtension) { |
614 base::ScopedTempDir temp_dir; | 614 base::ScopedTempDir temp_dir; |
615 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 615 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
616 base::FilePath test_file; | 616 base::FilePath test_file; |
617 ASSERT_TRUE(CopyTestDataAndGetTestFilePath( | 617 ASSERT_TRUE( |
618 test_data_dir_.AppendASCII(kTestFilePath), | 618 CopyTestDataAndGetTestFilePath(test_data_dir_.AppendASCII(kTestFilePath), |
619 temp_dir.path(), | 619 temp_dir.GetPath(), "test.", &test_file)); |
620 "test.", | |
621 &test_file)); | |
622 ASSERT_TRUE(RunPlatformAppTestWithFile( | 620 ASSERT_TRUE(RunPlatformAppTestWithFile( |
623 "platform_apps/launch_file_with_no_extension", test_file)) << message_; | 621 "platform_apps/launch_file_with_no_extension", test_file)) << message_; |
624 } | 622 } |
625 | 623 |
626 // Tests that launch data is sent through for a file with an empty extension if | 624 // Tests that launch data is sent through for a file with an empty extension if |
627 // a handler accepts *. | 625 // a handler accepts *. |
628 IN_PROC_BROWSER_TEST_F(PlatformAppWithFileBrowserTest, | 626 IN_PROC_BROWSER_TEST_F(PlatformAppWithFileBrowserTest, |
629 LaunchWithFileEmptyExtensionAcceptAny) { | 627 LaunchWithFileEmptyExtensionAcceptAny) { |
630 base::ScopedTempDir temp_dir; | 628 base::ScopedTempDir temp_dir; |
631 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 629 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
632 base::FilePath test_file; | 630 base::FilePath test_file; |
633 ASSERT_TRUE(CopyTestDataAndGetTestFilePath( | 631 ASSERT_TRUE( |
634 test_data_dir_.AppendASCII(kTestFilePath), | 632 CopyTestDataAndGetTestFilePath(test_data_dir_.AppendASCII(kTestFilePath), |
635 temp_dir.path(), | 633 temp_dir.GetPath(), "test.", &test_file)); |
636 "test.", | |
637 &test_file)); | |
638 ASSERT_TRUE(RunPlatformAppTestWithFile( | 634 ASSERT_TRUE(RunPlatformAppTestWithFile( |
639 "platform_apps/launch_file_with_any_extension", test_file)) << message_; | 635 "platform_apps/launch_file_with_any_extension", test_file)) << message_; |
640 } | 636 } |
641 #endif | 637 #endif |
642 | 638 |
643 // Tests that launch data is sent through for a file with no extension if a | 639 // Tests that launch data is sent through for a file with no extension if a |
644 // handler accepts *. | 640 // handler accepts *. |
645 IN_PROC_BROWSER_TEST_F(PlatformAppWithFileBrowserTest, | 641 IN_PROC_BROWSER_TEST_F(PlatformAppWithFileBrowserTest, |
646 LaunchWithFileWithoutExtensionAcceptAny) { | 642 LaunchWithFileWithoutExtensionAcceptAny) { |
647 ASSERT_TRUE(RunPlatformAppTestWithFileInTestDataDir( | 643 ASSERT_TRUE(RunPlatformAppTestWithFileInTestDataDir( |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 "platform_apps/get_display_path", kTestFilePath)) << message_; | 730 "platform_apps/get_display_path", kTestFilePath)) << message_; |
735 } | 731 } |
736 | 732 |
737 // Tests that the file is created if the file does not exist and the app has the | 733 // Tests that the file is created if the file does not exist and the app has the |
738 // fileSystem.write permission. | 734 // fileSystem.write permission. |
739 IN_PROC_BROWSER_TEST_F(PlatformAppWithFileBrowserTest, LaunchNewFile) { | 735 IN_PROC_BROWSER_TEST_F(PlatformAppWithFileBrowserTest, LaunchNewFile) { |
740 base::ScopedTempDir temp_dir; | 736 base::ScopedTempDir temp_dir; |
741 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 737 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); |
742 ASSERT_TRUE(RunPlatformAppTestWithFile( | 738 ASSERT_TRUE(RunPlatformAppTestWithFile( |
743 "platform_apps/launch_new_file", | 739 "platform_apps/launch_new_file", |
744 temp_dir.path().AppendASCII("new_file.txt"))) << message_; | 740 temp_dir.GetPath().AppendASCII("new_file.txt"))) |
| 741 << message_; |
745 } | 742 } |
746 | 743 |
747 #endif // !defined(OS_CHROMEOS) | 744 #endif // !defined(OS_CHROMEOS) |
748 | 745 |
749 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenLink) { | 746 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenLink) { |
750 ASSERT_TRUE(StartEmbeddedTestServer()); | 747 ASSERT_TRUE(StartEmbeddedTestServer()); |
751 content::WindowedNotificationObserver observer( | 748 content::WindowedNotificationObserver observer( |
752 chrome::NOTIFICATION_TAB_ADDED, | 749 chrome::NOTIFICATION_TAB_ADDED, |
753 content::Source<content::WebContentsDelegate>(browser())); | 750 content::Source<content::WebContentsDelegate>(browser())); |
754 LoadAndLaunchPlatformApp("open_link", "Launched"); | 751 LoadAndLaunchPlatformApp("open_link", "Launched"); |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 // https://crbug.com/620194. | 1382 // https://crbug.com/620194. |
1386 #define MAYBE_AppWindowIframe DISABLED_AppWindowIframe | 1383 #define MAYBE_AppWindowIframe DISABLED_AppWindowIframe |
1387 // Sends chrome.test.sendMessage from chrome.app.window.create's callback. | 1384 // Sends chrome.test.sendMessage from chrome.app.window.create's callback. |
1388 // The app window also adds an <iframe> to the page during window.onload. | 1385 // The app window also adds an <iframe> to the page during window.onload. |
1389 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_AppWindowIframe) { | 1386 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_AppWindowIframe) { |
1390 LoadAndLaunchPlatformApp("app_window_send_message", | 1387 LoadAndLaunchPlatformApp("app_window_send_message", |
1391 "APP_WINDOW_CREATE_CALLBACK"); | 1388 "APP_WINDOW_CREATE_CALLBACK"); |
1392 } | 1389 } |
1393 | 1390 |
1394 } // namespace extensions | 1391 } // namespace extensions |
OLD | NEW |