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

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

Issue 7649006: more changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix another typo Created 9 years, 4 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/memory/ref_counted.h" 5 #include "base/memory/ref_counted.h"
6 #include "base/stl_util.h" 6 #include "base/stl_util.h"
7 #include "chrome/browser/extensions/autoupdate_interceptor.h" 7 #include "chrome/browser/extensions/autoupdate_interceptor.h"
8 #include "chrome/browser/extensions/extension_browsertest.h" 8 #include "chrome/browser/extensions/extension_browsertest.h"
9 #include "chrome/browser/extensions/extension_host.h" 9 #include "chrome/browser/extensions/extension_host.h"
10 #include "chrome/browser/extensions/extension_service.h" 10 #include "chrome/browser/extensions/extension_service.h"
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 PrefService* prefs = browser()->profile()->GetPrefs(); 476 PrefService* prefs = browser()->profile()->GetPrefs();
477 const ListValue* forcelist = 477 const ListValue* forcelist =
478 prefs->GetList(prefs::kExtensionInstallForceList); 478 prefs->GetList(prefs::kExtensionInstallForceList);
479 ASSERT_TRUE(forcelist->empty()) << kForceInstallNotEmptyHelp; 479 ASSERT_TRUE(forcelist->empty()) << kForceInstallNotEmptyHelp;
480 480
481 { 481 {
482 // Set the policy as a user preference and fire notification observers. 482 // Set the policy as a user preference and fire notification observers.
483 ListPrefUpdate pref_update(prefs, prefs::kExtensionInstallForceList); 483 ListPrefUpdate pref_update(prefs, prefs::kExtensionInstallForceList);
484 ListValue* forcelist = pref_update.Get(); 484 ListValue* forcelist = pref_update.Get();
485 ASSERT_TRUE(forcelist->empty()); 485 ASSERT_TRUE(forcelist->empty());
486 forcelist->Append(Value::CreateStringValue( 486 forcelist->Append(base::StringValue::New(
487 std::string(kExtensionId) + 487 std::string(kExtensionId) +
488 ";http://localhost/autoupdate/manifest")); 488 ";http://localhost/autoupdate/manifest"));
489 } 489 }
490 490
491 // Check if the extension got installed. 491 // Check if the extension got installed.
492 ASSERT_TRUE(WaitForExtensionInstall()); 492 ASSERT_TRUE(WaitForExtensionInstall());
493 const ExtensionList* extensions = service->extensions(); 493 const ExtensionList* extensions = service->extensions();
494 ASSERT_EQ(size_before + 1, extensions->size()); 494 ASSERT_EQ(size_before + 1, extensions->size());
495 ASSERT_EQ(kExtensionId, extensions->at(size_before)->id()); 495 ASSERT_EQ(kExtensionId, extensions->at(size_before)->id());
496 EXPECT_EQ("2.0", extensions->at(size_before)->VersionString()); 496 EXPECT_EQ("2.0", extensions->at(size_before)->VersionString());
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 const Extension* extension = extensions->at(size_before); 553 const Extension* extension = extensions->at(size_before);
554 ASSERT_EQ(kExtensionId, extension->id()); 554 ASSERT_EQ(kExtensionId, extension->id());
555 EXPECT_EQ(Extension::INTERNAL, extension->location()); 555 EXPECT_EQ(Extension::INTERNAL, extension->location());
556 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); 556 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
557 557
558 // Setup the force install policy. It should override the location. 558 // Setup the force install policy. It should override the location.
559 { 559 {
560 ListPrefUpdate pref_update(prefs, prefs::kExtensionInstallForceList); 560 ListPrefUpdate pref_update(prefs, prefs::kExtensionInstallForceList);
561 ListValue* forcelist = pref_update.Get(); 561 ListValue* forcelist = pref_update.Get();
562 ASSERT_TRUE(forcelist->empty()); 562 ASSERT_TRUE(forcelist->empty());
563 forcelist->Append(Value::CreateStringValue( 563 forcelist->Append(base::StringValue::New(
564 std::string(kExtensionId) + ";http://localhost/autoupdate/manifest")); 564 std::string(kExtensionId) + ";http://localhost/autoupdate/manifest"));
565 } 565 }
566 ASSERT_TRUE(WaitForExtensionInstall()); 566 ASSERT_TRUE(WaitForExtensionInstall());
567 extensions = service->extensions(); 567 extensions = service->extensions();
568 ASSERT_EQ(size_before + 1, extensions->size()); 568 ASSERT_EQ(size_before + 1, extensions->size());
569 extension = extensions->at(size_before); 569 extension = extensions->at(size_before);
570 ASSERT_EQ(kExtensionId, extension->id()); 570 ASSERT_EQ(kExtensionId, extension->id());
571 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); 571 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location());
572 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); 572 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
573 573
(...skipping 26 matching lines...) Expand all
600 EXPECT_EQ(1u, service->disabled_extensions()->size()); 600 EXPECT_EQ(1u, service->disabled_extensions()->size());
601 EXPECT_EQ(kExtensionId, service->disabled_extensions()->at(0)->id()); 601 EXPECT_EQ(kExtensionId, service->disabled_extensions()->at(0)->id());
602 EXPECT_FALSE(service->IsExtensionEnabled(kExtensionId)); 602 EXPECT_FALSE(service->IsExtensionEnabled(kExtensionId));
603 603
604 // Install the policy again. It should overwrite the extension's location, 604 // Install the policy again. It should overwrite the extension's location,
605 // and force enable it too. 605 // and force enable it too.
606 { 606 {
607 ListPrefUpdate pref_update(prefs, prefs::kExtensionInstallForceList); 607 ListPrefUpdate pref_update(prefs, prefs::kExtensionInstallForceList);
608 ListValue* forcelist = pref_update.Get(); 608 ListValue* forcelist = pref_update.Get();
609 ASSERT_TRUE(forcelist->empty()); 609 ASSERT_TRUE(forcelist->empty());
610 forcelist->Append(Value::CreateStringValue( 610 forcelist->Append(base::StringValue::New(
611 std::string(kExtensionId) + ";http://localhost/autoupdate/manifest")); 611 std::string(kExtensionId) + ";http://localhost/autoupdate/manifest"));
612 } 612 }
613 ASSERT_TRUE(WaitForExtensionInstall()); 613 ASSERT_TRUE(WaitForExtensionInstall());
614 extensions = service->extensions(); 614 extensions = service->extensions();
615 ASSERT_EQ(size_before + 1, extensions->size()); 615 ASSERT_EQ(size_before + 1, extensions->size());
616 extension = extensions->at(size_before); 616 extension = extensions->at(size_before);
617 ASSERT_EQ(kExtensionId, extension->id()); 617 ASSERT_EQ(kExtensionId, extension->id());
618 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location()); 618 EXPECT_EQ(Extension::EXTERNAL_POLICY_DOWNLOAD, extension->location());
619 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId)); 619 EXPECT_TRUE(service->IsExtensionEnabled(kExtensionId));
620 EXPECT_TRUE(service->disabled_extensions()->empty()); 620 EXPECT_TRUE(service->disabled_extensions()->empty());
621 } 621 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_management_api.cc ('k') | chrome/browser/extensions/extension_message_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698