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

Side by Side Diff: chrome/browser/profile_resetter/profile_resetter_unittest.cc

Issue 128223003: Add unit tests to ensure that certain types of extensions are not disabled by Profile Reset. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/profile_resetter/profile_resetter.h" 5 #include "chrome/browser/profile_resetter/profile_resetter.h"
6 6
7 #include "base/json/json_string_value_serializer.h" 7 #include "base/json/json_string_value_serializer.h"
8 #include "base/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/content_settings/host_content_settings_map.h" 10 #include "chrome/browser/content_settings/host_content_settings_map.h"
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 ThemeServiceFactory::GetForProfile(profile()); 470 ThemeServiceFactory::GetForProfile(profile());
471 EXPECT_FALSE(theme_service->UsingDefaultTheme()); 471 EXPECT_FALSE(theme_service->UsingDefaultTheme());
472 472
473 scoped_refptr<Extension> ext2 = CreateExtension( 473 scoped_refptr<Extension> ext2 = CreateExtension(
474 ASCIIToUTF16("example2"), 474 ASCIIToUTF16("example2"),
475 base::FilePath(FILE_PATH_LITERAL("//nonexistent")), 475 base::FilePath(FILE_PATH_LITERAL("//nonexistent")),
476 Manifest::INVALID_LOCATION, 476 Manifest::INVALID_LOCATION,
477 extensions::Manifest::TYPE_EXTENSION, 477 extensions::Manifest::TYPE_EXTENSION,
478 false); 478 false);
479 service_->AddExtension(ext2.get()); 479 service_->AddExtension(ext2.get());
480 // Components and external policy extensions shouldn't be deleted. 480 // Component extensions and policy-managed extensions shouldn't be disabled.
481 scoped_refptr<Extension> ext3 = CreateExtension( 481 scoped_refptr<Extension> ext3 = CreateExtension(
482 ASCIIToUTF16("example3"), 482 ASCIIToUTF16("example3"),
483 base::FilePath(FILE_PATH_LITERAL("//nonexistent2")), 483 base::FilePath(FILE_PATH_LITERAL("//nonexistent2")),
484 Manifest::COMPONENT, 484 Manifest::COMPONENT,
485 extensions::Manifest::TYPE_EXTENSION, 485 extensions::Manifest::TYPE_EXTENSION,
486 false); 486 false);
487 service_->AddExtension(ext3.get()); 487 service_->AddExtension(ext3.get());
488 scoped_refptr<Extension> ext4 = 488 scoped_refptr<Extension> ext4 = CreateExtension(
489 CreateExtension(ASCIIToUTF16("example4"), 489 ASCIIToUTF16("example4"),
490 base::FilePath(FILE_PATH_LITERAL("//nonexistent3")), 490 base::FilePath(FILE_PATH_LITERAL("//nonexistent3")),
491 Manifest::EXTERNAL_POLICY_DOWNLOAD, 491 Manifest::EXTERNAL_POLICY_DOWNLOAD,
492 extensions::Manifest::TYPE_EXTENSION, 492 extensions::Manifest::TYPE_EXTENSION,
493 false); 493 false);
494 service_->AddExtension(ext4.get()); 494 service_->AddExtension(ext4.get());
495 EXPECT_EQ(4u, service_->extensions()->size()); 495 scoped_refptr<Extension> ext5 = CreateExtension(
496 ASCIIToUTF16("example5"),
497 base::FilePath(FILE_PATH_LITERAL("//nonexistent4")),
498 Manifest::EXTERNAL_COMPONENT,
499 extensions::Manifest::TYPE_EXTENSION,
500 false);
501 service_->AddExtension(ext5.get());
502 scoped_refptr<Extension> ext6 = CreateExtension(
503 ASCIIToUTF16("example6"),
504 base::FilePath(FILE_PATH_LITERAL("//nonexistent5")),
505 Manifest::EXTERNAL_POLICY,
506 extensions::Manifest::TYPE_EXTENSION,
507 false);
508 service_->AddExtension(ext6.get());
509 EXPECT_EQ(6u, service_->extensions()->size());
496 510
497 ResetAndWait(ProfileResetter::EXTENSIONS); 511 ResetAndWait(ProfileResetter::EXTENSIONS);
498 EXPECT_EQ(2u, service_->extensions()->size()); 512 EXPECT_EQ(4u, service_->extensions()->size());
499 EXPECT_FALSE(service_->extensions()->Contains(theme->id())); 513 EXPECT_FALSE(service_->extensions()->Contains(theme->id()));
500 EXPECT_FALSE(service_->extensions()->Contains(ext2->id())); 514 EXPECT_FALSE(service_->extensions()->Contains(ext2->id()));
501 EXPECT_TRUE(service_->extensions()->Contains(ext3->id())); 515 EXPECT_TRUE(service_->extensions()->Contains(ext3->id()));
502 EXPECT_TRUE(service_->extensions()->Contains(ext4->id())); 516 EXPECT_TRUE(service_->extensions()->Contains(ext4->id()));
517 EXPECT_TRUE(service_->extensions()->Contains(ext5->id()));
518 EXPECT_TRUE(service_->extensions()->Contains(ext6->id()));
503 EXPECT_TRUE(theme_service->UsingDefaultTheme()); 519 EXPECT_TRUE(theme_service->UsingDefaultTheme());
504 } 520 }
505 521
506 TEST_F(ProfileResetterTest, ResetExtensionsByDisablingNonOrganic) { 522 TEST_F(ProfileResetterTest, ResetExtensionsByDisablingNonOrganic) {
507 scoped_refptr<Extension> ext2 = CreateExtension( 523 scoped_refptr<Extension> ext2 = CreateExtension(
508 ASCIIToUTF16("example2"), 524 ASCIIToUTF16("example2"),
509 base::FilePath(FILE_PATH_LITERAL("//nonexistent")), 525 base::FilePath(FILE_PATH_LITERAL("//nonexistent")),
510 Manifest::INVALID_LOCATION, 526 Manifest::INVALID_LOCATION,
511 extensions::Manifest::TYPE_EXTENSION, 527 extensions::Manifest::TYPE_EXTENSION,
512 false); 528 false);
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 ASSERT_TRUE(dict->GetString("key", &value)); 864 ASSERT_TRUE(dict->GetString("key", &value));
849 if (value == "Extensions") { 865 if (value == "Extensions") {
850 base::string16 extensions; 866 base::string16 extensions;
851 EXPECT_TRUE(dict->GetString("value", &extensions)); 867 EXPECT_TRUE(dict->GetString("value", &extensions));
852 EXPECT_EQ(base::WideToUTF16(L"Tiësto"), extensions); 868 EXPECT_EQ(base::WideToUTF16(L"Tiësto"), extensions);
853 } 869 }
854 } 870 }
855 } 871 }
856 872
857 } // namespace 873 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698