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

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 298883006: Rename NOTIFICATION_EXTENSION_INSTALLED to (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 6 years, 7 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
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 <algorithm> 5 #include <algorithm>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 1534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1545 GURL url(URLRequestMockHTTPJob::GetMockUrl(path)); 1545 GURL url(URLRequestMockHTTPJob::GetMockUrl(path));
1546 1546
1547 // Setting the forcelist extension should install "good_v1.crx". 1547 // Setting the forcelist extension should install "good_v1.crx".
1548 base::ListValue forcelist; 1548 base::ListValue forcelist;
1549 forcelist.Append(base::Value::CreateStringValue(base::StringPrintf( 1549 forcelist.Append(base::Value::CreateStringValue(base::StringPrintf(
1550 "%s;%s", kGoodCrxId, url.spec().c_str()))); 1550 "%s;%s", kGoodCrxId, url.spec().c_str())));
1551 PolicyMap policies; 1551 PolicyMap policies;
1552 policies.Set(key::kExtensionInstallForcelist, POLICY_LEVEL_MANDATORY, 1552 policies.Set(key::kExtensionInstallForcelist, POLICY_LEVEL_MANDATORY,
1553 POLICY_SCOPE_USER, forcelist.DeepCopy(), NULL); 1553 POLICY_SCOPE_USER, forcelist.DeepCopy(), NULL);
1554 content::WindowedNotificationObserver observer( 1554 content::WindowedNotificationObserver observer(
1555 chrome::NOTIFICATION_EXTENSION_INSTALLED, 1555 chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED,
1556 content::NotificationService::AllSources()); 1556 content::NotificationService::AllSources());
1557 UpdateProviderPolicy(policies); 1557 UpdateProviderPolicy(policies);
1558 observer.Wait(); 1558 observer.Wait();
1559 // Note: Cannot check that the notification details match the expected 1559 // Note: Cannot check that the notification details match the expected
1560 // exception, since the details object has already been freed prior to 1560 // exception, since the details object has already been freed prior to
1561 // the completion of observer.Wait(). 1561 // the completion of observer.Wait().
1562 1562
1563 EXPECT_TRUE(service->GetExtensionById(kGoodCrxId, true)); 1563 EXPECT_TRUE(service->GetExtensionById(kGoodCrxId, true));
1564 1564
1565 // The user is not allowed to uninstall force-installed extensions. 1565 // The user is not allowed to uninstall force-installed extensions.
(...skipping 17 matching lines...) Expand all
1583 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); 1583 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
1584 interceptor.PushJobCallback( 1584 interceptor.PushJobCallback(
1585 TestRequestInterceptor::FileJob( 1585 TestRequestInterceptor::FileJob(
1586 test_path.Append(kTestExtensionsDir).Append(kGood2CrxManifestName))); 1586 test_path.Append(kTestExtensionsDir).Append(kGood2CrxManifestName)));
1587 1587
1588 // Updating the force-installed extension. 1588 // Updating the force-installed extension.
1589 extensions::ExtensionUpdater* updater = service->updater(); 1589 extensions::ExtensionUpdater* updater = service->updater();
1590 extensions::ExtensionUpdater::CheckParams params; 1590 extensions::ExtensionUpdater::CheckParams params;
1591 params.install_immediately = true; 1591 params.install_immediately = true;
1592 content::WindowedNotificationObserver update_observer( 1592 content::WindowedNotificationObserver update_observer(
1593 chrome::NOTIFICATION_EXTENSION_INSTALLED, 1593 chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED,
1594 content::NotificationService::AllSources()); 1594 content::NotificationService::AllSources());
1595 updater->CheckNow(params); 1595 updater->CheckNow(params);
1596 update_observer.Wait(); 1596 update_observer.Wait();
1597 1597
1598 const base::Version* new_version = 1598 const base::Version* new_version =
1599 service->GetExtensionById(kGoodCrxId, true)->version(); 1599 service->GetExtensionById(kGoodCrxId, true)->version();
1600 ASSERT_TRUE(new_version->IsValid()); 1600 ASSERT_TRUE(new_version->IsValid());
1601 base::Version old_version(old_version_number); 1601 base::Version old_version(old_version_number);
1602 ASSERT_TRUE(old_version.IsValid()); 1602 ASSERT_TRUE(old_version.IsValid());
1603 1603
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 // Install the policy and trigger another download. 1713 // Install the policy and trigger another download.
1714 base::ListValue install_sources; 1714 base::ListValue install_sources;
1715 install_sources.AppendString(install_source_url.spec()); 1715 install_sources.AppendString(install_source_url.spec());
1716 install_sources.AppendString(referrer_url.spec()); 1716 install_sources.AppendString(referrer_url.spec());
1717 PolicyMap policies; 1717 PolicyMap policies;
1718 policies.Set(key::kExtensionInstallSources, POLICY_LEVEL_MANDATORY, 1718 policies.Set(key::kExtensionInstallSources, POLICY_LEVEL_MANDATORY,
1719 POLICY_SCOPE_USER, install_sources.DeepCopy(), NULL); 1719 POLICY_SCOPE_USER, install_sources.DeepCopy(), NULL);
1720 UpdateProviderPolicy(policies); 1720 UpdateProviderPolicy(policies);
1721 1721
1722 content::WindowedNotificationObserver observer( 1722 content::WindowedNotificationObserver observer(
1723 chrome::NOTIFICATION_EXTENSION_INSTALLED, 1723 chrome::NOTIFICATION_EXTENSION_INSTALLED_DEPRECATED,
1724 content::NotificationService::AllSources()); 1724 content::NotificationService::AllSources());
1725 PerformClick(1, 0); 1725 PerformClick(1, 0);
1726 observer.Wait(); 1726 observer.Wait();
1727 // Note: Cannot check that the notification details match the expected 1727 // Note: Cannot check that the notification details match the expected
1728 // exception, since the details object has already been freed prior to 1728 // exception, since the details object has already been freed prior to
1729 // the completion of observer.Wait(). 1729 // the completion of observer.Wait().
1730 1730
1731 // The first extension shouldn't be present, the second should be there. 1731 // The first extension shouldn't be present, the second should be there.
1732 EXPECT_FALSE(extension_service()->GetExtensionById(kGoodCrxId, true)); 1732 EXPECT_FALSE(extension_service()->GetExtensionById(kGoodCrxId, true));
1733 EXPECT_TRUE(extension_service()->GetExtensionById(kAdBlockCrxId, false)); 1733 EXPECT_TRUE(extension_service()->GetExtensionById(kAdBlockCrxId, false));
(...skipping 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
2970 PrefService* prefs = browser()->profile()->GetPrefs(); 2970 PrefService* prefs = browser()->profile()->GetPrefs();
2971 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed( 2971 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed(
2972 prefs, "host.name")); 2972 prefs, "host.name"));
2973 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( 2973 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed(
2974 prefs, "other.host.name")); 2974 prefs, "other.host.name"));
2975 } 2975 }
2976 2976
2977 #endif // !defined(CHROME_OS) 2977 #endif // !defined(CHROME_OS)
2978 2978
2979 } // namespace policy 2979 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/performance_monitor/performance_monitor.cc ('k') | chrome/browser/search/hotword_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698