| OLD | NEW |
| 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/message_loop/message_loop.h" | 5 #include "base/message_loop/message_loop.h" |
| 6 #include "base/values.h" | 6 #include "base/values.h" |
| 7 #include "chrome/browser/content_settings/cookie_settings.h" | 7 #include "chrome/browser/content_settings/cookie_settings.h" |
| 8 #include "chrome/browser/extensions/extension_special_storage_policy.h" | 8 #include "chrome/browser/extensions/extension_special_storage_policy.h" |
| 9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
| 10 #include "components/content_settings/core/common/content_settings.h" | 10 #include "components/content_settings/core/common/content_settings.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 class ExtensionSpecialStoragePolicyTest : public testing::Test { | 29 class ExtensionSpecialStoragePolicyTest : public testing::Test { |
| 30 protected: | 30 protected: |
| 31 class PolicyChangeObserver : public SpecialStoragePolicy::Observer { | 31 class PolicyChangeObserver : public SpecialStoragePolicy::Observer { |
| 32 public: | 32 public: |
| 33 PolicyChangeObserver() | 33 PolicyChangeObserver() |
| 34 : expected_type_(NOTIFICATION_TYPE_NONE), | 34 : expected_type_(NOTIFICATION_TYPE_NONE), |
| 35 expected_change_flags_(0) { | 35 expected_change_flags_(0) { |
| 36 } | 36 } |
| 37 | 37 |
| 38 virtual void OnGranted(const GURL& origin, | 38 void OnGranted(const GURL& origin, int change_flags) override { |
| 39 int change_flags) override { | |
| 40 EXPECT_EQ(expected_type_, NOTIFICATION_TYPE_GRANT); | 39 EXPECT_EQ(expected_type_, NOTIFICATION_TYPE_GRANT); |
| 41 EXPECT_EQ(expected_origin_, origin); | 40 EXPECT_EQ(expected_origin_, origin); |
| 42 EXPECT_EQ(expected_change_flags_, change_flags); | 41 EXPECT_EQ(expected_change_flags_, change_flags); |
| 43 expected_type_ = NOTIFICATION_TYPE_NONE; | 42 expected_type_ = NOTIFICATION_TYPE_NONE; |
| 44 } | 43 } |
| 45 | 44 |
| 46 virtual void OnRevoked(const GURL& origin, | 45 void OnRevoked(const GURL& origin, int change_flags) override { |
| 47 int change_flags) override { | |
| 48 EXPECT_EQ(expected_type_, NOTIFICATION_TYPE_REVOKE); | 46 EXPECT_EQ(expected_type_, NOTIFICATION_TYPE_REVOKE); |
| 49 EXPECT_EQ(expected_origin_, origin); | 47 EXPECT_EQ(expected_origin_, origin); |
| 50 EXPECT_EQ(expected_change_flags_, change_flags); | 48 EXPECT_EQ(expected_change_flags_, change_flags); |
| 51 expected_type_ = NOTIFICATION_TYPE_NONE; | 49 expected_type_ = NOTIFICATION_TYPE_NONE; |
| 52 } | 50 } |
| 53 | 51 |
| 54 virtual void OnCleared() override { | 52 void OnCleared() override { |
| 55 EXPECT_EQ(expected_type_, NOTIFICATION_TYPE_CLEAR); | 53 EXPECT_EQ(expected_type_, NOTIFICATION_TYPE_CLEAR); |
| 56 expected_type_ = NOTIFICATION_TYPE_NONE; | 54 expected_type_ = NOTIFICATION_TYPE_NONE; |
| 57 } | 55 } |
| 58 | 56 |
| 59 void ExpectGrant(const std::string& extension_id, | 57 void ExpectGrant(const std::string& extension_id, |
| 60 int change_flags) { | 58 int change_flags) { |
| 61 expected_type_ = NOTIFICATION_TYPE_GRANT; | 59 expected_type_ = NOTIFICATION_TYPE_GRANT; |
| 62 expected_origin_ = Extension::GetBaseURLFromExtensionId(extension_id); | 60 expected_origin_ = Extension::GetBaseURLFromExtensionId(extension_id); |
| 63 expected_change_flags_ = change_flags; | 61 expected_change_flags_ = change_flags; |
| 64 } | 62 } |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 EXPECT_TRUE(observer.IsCompleted()); | 396 EXPECT_TRUE(observer.IsCompleted()); |
| 399 } | 397 } |
| 400 | 398 |
| 401 observer.ExpectClear(); | 399 observer.ExpectClear(); |
| 402 policy_->RevokeRightsForAllExtensions(); | 400 policy_->RevokeRightsForAllExtensions(); |
| 403 message_loop.RunUntilIdle(); | 401 message_loop.RunUntilIdle(); |
| 404 EXPECT_TRUE(observer.IsCompleted()); | 402 EXPECT_TRUE(observer.IsCompleted()); |
| 405 | 403 |
| 406 policy_->RemoveObserver(&observer); | 404 policy_->RemoveObserver(&observer); |
| 407 } | 405 } |
| OLD | NEW |