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

Side by Side Diff: chrome/browser/chromeos/file_manager/file_tasks_unittest.cc

Issue 714133002: Add more management policy checking after extension installed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix CrOS compile Created 6 years, 1 month 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
OLDNEW
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 "chrome/browser/chromeos/file_manager/file_tasks.h" 5 #include "chrome/browser/chromeos/file_manager/file_tasks.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 "types", 503 "types",
504 extensions::ListBuilder().Append("text/plain"))))); 504 extensions::ListBuilder().Append("text/plain")))));
505 ephemeral_app.SetID(kEphemeralId); 505 ephemeral_app.SetID(kEphemeralId);
506 scoped_refptr<extensions::Extension> built_ephemeral_app( 506 scoped_refptr<extensions::Extension> built_ephemeral_app(
507 ephemeral_app.Build()); 507 ephemeral_app.Build());
508 extension_service_->AddExtension(built_ephemeral_app.get()); 508 extension_service_->AddExtension(built_ephemeral_app.get());
509 extensions::ExtensionPrefs* extension_prefs = 509 extensions::ExtensionPrefs* extension_prefs =
510 extensions::ExtensionPrefs::Get(&test_profile_); 510 extensions::ExtensionPrefs::Get(&test_profile_);
511 extension_prefs->OnExtensionInstalled(built_ephemeral_app.get(), 511 extension_prefs->OnExtensionInstalled(built_ephemeral_app.get(),
512 extensions::Extension::ENABLED, 512 extensions::Extension::ENABLED,
513 extensions::Extension::DISABLE_NONE,
513 syncer::StringOrdinal(), 514 syncer::StringOrdinal(),
514 extensions::kInstallFlagIsEphemeral, 515 extensions::kInstallFlagIsEphemeral,
515 std::string()); 516 std::string());
516 517
517 // Find apps for a "text/plain" file. Foo.app and Bar.app should be found. 518 // Find apps for a "text/plain" file. Foo.app and Bar.app should be found.
518 PathAndMimeTypeSet path_mime_set; 519 PathAndMimeTypeSet path_mime_set;
519 path_mime_set.insert( 520 path_mime_set.insert(
520 std::make_pair( 521 std::make_pair(
521 drive::util::GetDriveMountPointPath(&test_profile_).AppendASCII( 522 drive::util::GetDriveMountPointPath(&test_profile_).AppendASCII(
522 "foo.txt"), 523 "foo.txt"),
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 extensions::ListBuilder().Append( 625 extensions::ListBuilder().Append(
625 "filesystem:*.txt"))))); 626 "filesystem:*.txt")))));
626 ephemeral_app.SetID(kEphemeralId); 627 ephemeral_app.SetID(kEphemeralId);
627 scoped_refptr<extensions::Extension> built_ephemeral_app( 628 scoped_refptr<extensions::Extension> built_ephemeral_app(
628 ephemeral_app.Build()); 629 ephemeral_app.Build());
629 extension_service_->AddExtension(built_ephemeral_app.get()); 630 extension_service_->AddExtension(built_ephemeral_app.get());
630 extensions::ExtensionPrefs* extension_prefs = 631 extensions::ExtensionPrefs* extension_prefs =
631 extensions::ExtensionPrefs::Get(&test_profile_); 632 extensions::ExtensionPrefs::Get(&test_profile_);
632 extension_prefs->OnExtensionInstalled(built_ephemeral_app.get(), 633 extension_prefs->OnExtensionInstalled(built_ephemeral_app.get(),
633 extensions::Extension::ENABLED, 634 extensions::Extension::ENABLED,
635 extensions::Extension::DISABLE_NONE,
634 syncer::StringOrdinal(), 636 syncer::StringOrdinal(),
635 extensions::kInstallFlagIsEphemeral, 637 extensions::kInstallFlagIsEphemeral,
636 std::string()); 638 std::string());
637 639
638 // Find apps for a ".txt" file. Foo.app and Bar.app should be found. 640 // Find apps for a ".txt" file. Foo.app and Bar.app should be found.
639 std::vector<GURL> file_urls; 641 std::vector<GURL> file_urls;
640 file_urls.push_back(GURL("filesystem:chrome-extension://id/dir/foo.txt")); 642 file_urls.push_back(GURL("filesystem:chrome-extension://id/dir/foo.txt"));
641 643
642 std::vector<FullTaskDescriptor> tasks; 644 std::vector<FullTaskDescriptor> tasks;
643 FindFileBrowserHandlerTasks(&test_profile_, file_urls, &tasks); 645 FindFileBrowserHandlerTasks(&test_profile_, file_urls, &tasks);
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 // treated as non-generic handler. 985 // treated as non-generic handler.
984 EXPECT_EQ("Baz", jpg_result[1].task_title()); 986 EXPECT_EQ("Baz", jpg_result[1].task_title());
985 EXPECT_FALSE(jpg_result[1].is_generic_file_handler()); 987 EXPECT_FALSE(jpg_result[1].is_generic_file_handler());
986 // Qux app provides a handler for all types. 988 // Qux app provides a handler for all types.
987 EXPECT_EQ("Qux", jpg_result[2].task_title()); 989 EXPECT_EQ("Qux", jpg_result[2].task_title());
988 EXPECT_TRUE(jpg_result[2].is_generic_file_handler()); 990 EXPECT_TRUE(jpg_result[2].is_generic_file_handler());
989 } 991 }
990 992
991 } // namespace file_tasks 993 } // namespace file_tasks
992 } // namespace file_manager. 994 } // namespace file_manager.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698