Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Side by Side Diff: chrome/browser/extensions/platform_app_browsertest.cc

Issue 14254002: Treat unknown MIME type as application/octet-stream when launching apps. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/platform_app_launcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/file_util.h" 6 #include "base/file_util.h"
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/test/test_timeouts.h" 8 #include "base/test/test_timeouts.h"
9 #include "base/threading/platform_thread.h" 9 #include "base/threading/platform_thread.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 } 454 }
455 455
456 // Tests that no launch data is sent through if the platform app does not 456 // Tests that no launch data is sent through if the platform app does not
457 // provide an intent. 457 // provide an intent.
458 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchWithNoIntent) { 458 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchWithNoIntent) {
459 SetCommandLineArg(kTestFilePath); 459 SetCommandLineArg(kTestFilePath);
460 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch_no_intent")) 460 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch_no_intent"))
461 << message_; 461 << message_;
462 } 462 }
463 463
464 // Tests that no launch data is sent through if the file MIME type cannot 464 // Tests that launch data is sent through with the MIME type set to
465 // be read. 465 // application/octet-stream if the file MIME type cannot be read.
466 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchNoType) { 466 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchNoType) {
467 SetCommandLineArg("platform_apps/launch_files/test.unknownextension"); 467 SetCommandLineArg("platform_apps/launch_files/test.unknownextension");
468 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch_invalid")) 468 ASSERT_TRUE(RunPlatformAppTest(
469 << message_; 469 "platform_apps/launch_application_octet_stream")) << message_;
470 } 470 }
471 471
472 // Tests that no launch data is sent through if the file does not exist. 472 // Tests that no launch data is sent through if the file does not exist.
473 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchNoFile) { 473 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, LaunchNoFile) {
474 SetCommandLineArg("platform_apps/launch_files/doesnotexist.txt"); 474 SetCommandLineArg("platform_apps/launch_files/doesnotexist.txt");
475 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch_invalid")) 475 ASSERT_TRUE(RunPlatformAppTest("platform_apps/launch_invalid"))
476 << message_; 476 << message_;
477 } 477 }
478 478
479 // Tests that no launch data is sent through if the argument is a directory. 479 // Tests that no launch data is sent through if the argument is a directory.
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
806 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); 806 ASSERT_TRUE(launched_listener.WaitUntilSatisfied());
807 807
808 EXPECT_EQ(1LU, GetShellWindowCount()); 808 EXPECT_EQ(1LU, GetShellWindowCount());
809 ShellWindowRegistry::ShellWindowSet shell_windows = ShellWindowRegistry::Get( 809 ShellWindowRegistry::ShellWindowSet shell_windows = ShellWindowRegistry::Get(
810 browser()->profile())->shell_windows(); 810 browser()->profile())->shell_windows();
811 EXPECT_TRUE((*shell_windows.begin())->web_contents()-> 811 EXPECT_TRUE((*shell_windows.begin())->web_contents()->
812 GetRenderWidgetHostView()->HasFocus()); 812 GetRenderWidgetHostView()->HasFocus());
813 } 813 }
814 814
815 } // namespace extensions 815 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/platform_app_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698