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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
7 #include "base/test/test_timeouts.h" | 7 #include "base/test/test_timeouts.h" |
8 #include "base/threading/platform_thread.h" | 8 #include "base/threading/platform_thread.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 ASSERT_TRUE(launched_listener2.WaitUntilSatisfied()); | 390 ASSERT_TRUE(launched_listener2.WaitUntilSatisfied()); |
391 | 391 |
392 // There are two total shell windows, but each app can only see its own. | 392 // There are two total shell windows, but each app can only see its own. |
393 ASSERT_EQ(2U, GetShellWindowCount()); | 393 ASSERT_EQ(2U, GetShellWindowCount()); |
394 // TODO(jeremya): as above, this requires more extension functions. | 394 // TODO(jeremya): as above, this requires more extension functions. |
395 } | 395 } |
396 | 396 |
397 // ChromeOS does not support passing arguments on the command line, so the tests | 397 // ChromeOS does not support passing arguments on the command line, so the tests |
398 // that rely on this functionality are disabled. | 398 // that rely on this functionality are disabled. |
399 #if !defined(OS_CHROMEOS) | 399 #if !defined(OS_CHROMEOS) |
400 // TODO(thakis): Figure out what to do here, reenable. | |
401 // Tests that command line parameters get passed through to platform apps | 400 // Tests that command line parameters get passed through to platform apps |
402 // via launchData correctly when launching with a file. | 401 // via launchData correctly when launching with a file. |
403 // TODO(benwells/jeremya): tests need a way to specify a handler ID. | 402 // TODO(benwells/jeremya): tests need a way to specify a handler ID. |
404 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DISABLED_LaunchWithFile) { | 403 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchWithFile) { |
405 SetCommandLineArg(kTestFilePath); | 404 SetCommandLineArg(kTestFilePath); |
406 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch_file")) | 405 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch_file")) |
407 << message_; | 406 << message_; |
408 } | 407 } |
409 | 408 |
410 // TODO(thakis): Figure out what to do here, reenable. | |
411 // Tests that relative paths can be passed through to the platform app. | 409 // Tests that relative paths can be passed through to the platform app. |
412 // This test doesn't use the normal test infrastructure as it needs to open | 410 // This test doesn't use the normal test infrastructure as it needs to open |
413 // the application differently to all other platform app tests, by setting | 411 // the application differently to all other platform app tests, by setting |
414 // the chrome::AppLaunchParams.current_directory field. | 412 // the chrome::AppLaunchParams.current_directory field. |
415 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 413 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchWithRelativeFile) { |
416 DISABLED_LaunchWithRelativeFile) { | |
417 // Setup the command line | 414 // Setup the command line |
418 ClearCommandLineArgs(); | 415 ClearCommandLineArgs(); |
419 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 416 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
420 base::FilePath relative_test_doc = | 417 base::FilePath relative_test_doc = |
421 base::FilePath::FromUTF8Unsafe(kTestFilePath); | 418 base::FilePath::FromUTF8Unsafe(kTestFilePath); |
422 relative_test_doc = relative_test_doc.NormalizePathSeparators(); | 419 relative_test_doc = relative_test_doc.NormalizePathSeparators(); |
423 command_line->AppendArgPath(relative_test_doc); | 420 command_line->AppendArgPath(relative_test_doc); |
424 | 421 |
425 // Load the extension | 422 // Load the extension |
426 ResultCatcher catcher; | 423 ResultCatcher catcher; |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 } | 477 } |
481 | 478 |
482 // Tests that no launch data is sent through if there are no arguments passed | 479 // Tests that no launch data is sent through if there are no arguments passed |
483 // on the command line | 480 // on the command line |
484 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchWithNothing) { | 481 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchWithNothing) { |
485 ClearCommandLineArgs(); | 482 ClearCommandLineArgs(); |
486 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch_nothing")) | 483 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch_nothing")) |
487 << message_; | 484 << message_; |
488 } | 485 } |
489 | 486 |
490 // TODO(thakis): Figure out what to do with this test. | |
491 // Test that platform apps can use the chrome.fileSystem.getDisplayPath | 487 // Test that platform apps can use the chrome.fileSystem.getDisplayPath |
492 // function to get the native file system path of a file they are launched with. | 488 // function to get the native file system path of a file they are launched with. |
493 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, DISABLED_GetDisplayPath) { | 489 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, GetDisplayPath) { |
494 SetCommandLineArg(kTestFilePath); | 490 SetCommandLineArg(kTestFilePath); |
495 ASSERT_TRUE(RunPlatformAppTest("platform_apps/get_display_path")) | 491 ASSERT_TRUE(RunPlatformAppTest("platform_apps/get_display_path")) |
496 << message_; | 492 << message_; |
497 } | 493 } |
498 | 494 |
499 #endif // defined(OS_CHROMEOS) | 495 #endif // defined(OS_CHROMEOS) |
500 | 496 |
501 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenLink) { | 497 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, OpenLink) { |
502 ASSERT_TRUE(StartTestServer()); | 498 ASSERT_TRUE(StartTestServer()); |
503 content::WindowedNotificationObserver observer( | 499 content::WindowedNotificationObserver observer( |
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 #define MAYBE_WebContentsHasFocus WebContentsHasFocus | 845 #define MAYBE_WebContentsHasFocus WebContentsHasFocus |
850 #endif | 846 #endif |
851 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WebContentsHasFocus) { | 847 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, MAYBE_WebContentsHasFocus) { |
852 const Extension* extension = LoadAndLaunchPlatformApp("minimal"); | 848 const Extension* extension = LoadAndLaunchPlatformApp("minimal"); |
853 ShellWindow* window = CreateShellWindow(extension); | 849 ShellWindow* window = CreateShellWindow(extension); |
854 EXPECT_TRUE(window->web_contents()->GetRenderWidgetHostView()->HasFocus()); | 850 EXPECT_TRUE(window->web_contents()->GetRenderWidgetHostView()->HasFocus()); |
855 CloseShellWindow(window); | 851 CloseShellWindow(window); |
856 } | 852 } |
857 | 853 |
858 } // namespace extensions | 854 } // namespace extensions |
OLD | NEW |