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

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

Issue 14694010: Consolidate manifest handler registration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
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 "base/message_loop.h" 5 #include "base/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/common/content_settings.h" 9 #include "chrome/common/content_settings.h"
10 #include "chrome/common/content_settings_types.h" 10 #include "chrome/common/content_settings_types.h"
11 #include "chrome/common/extensions/extension.h" 11 #include "chrome/common/extensions/extension.h"
12 #include "chrome/common/extensions/extension_manifest_constants.h" 12 #include "chrome/common/extensions/extension_manifest_constants.h"
13 #include "chrome/common/extensions/extension_unittest.h"
14 #include "chrome/common/extensions/manifest.h" 13 #include "chrome/common/extensions/manifest.h"
15 #include "chrome/common/extensions/manifest_handler.h"
16 #include "chrome/test/base/testing_profile.h" 14 #include "chrome/test/base/testing_profile.h"
17 #include "content/public/test/test_browser_thread.h" 15 #include "content/public/test/test_browser_thread.h"
18 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
19 17
20 using content::BrowserThread; 18 using content::BrowserThread;
21 using extensions::Extension; 19 using extensions::Extension;
22 using extensions::Manifest; 20 using extensions::Manifest;
23 using quota::SpecialStoragePolicy; 21 using quota::SpecialStoragePolicy;
24 22
25 typedef SpecialStoragePolicy::StoragePolicy StoragePolicy; 23 typedef SpecialStoragePolicy::StoragePolicy StoragePolicy;
26 24
27 namespace keys = extension_manifest_keys; 25 namespace keys = extension_manifest_keys;
28 26
29 class ExtensionSpecialStoragePolicyTest : public extensions::ExtensionTest { 27 class ExtensionSpecialStoragePolicyTest : public testing::Test {
30 protected: 28 protected:
31 class PolicyChangeObserver : public SpecialStoragePolicy::Observer { 29 class PolicyChangeObserver : public SpecialStoragePolicy::Observer {
32 public: 30 public:
33 PolicyChangeObserver() 31 PolicyChangeObserver()
34 : expected_type_(NOTIFICATION_TYPE_NONE), 32 : expected_type_(NOTIFICATION_TYPE_NONE),
35 expected_change_flags_(0) { 33 expected_change_flags_(0) {
36 } 34 }
37 35
38 virtual void OnGranted(const GURL& origin, 36 virtual void OnGranted(const GURL& origin,
39 int change_flags) OVERRIDE { 37 int change_flags) OVERRIDE {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 NOTIFICATION_TYPE_CLEAR, 84 NOTIFICATION_TYPE_CLEAR,
87 } expected_type_; 85 } expected_type_;
88 86
89 GURL expected_origin_; 87 GURL expected_origin_;
90 int expected_change_flags_; 88 int expected_change_flags_;
91 89
92 DISALLOW_COPY_AND_ASSIGN(PolicyChangeObserver); 90 DISALLOW_COPY_AND_ASSIGN(PolicyChangeObserver);
93 }; 91 };
94 92
95 virtual void SetUp() OVERRIDE { 93 virtual void SetUp() OVERRIDE {
96 extensions::ExtensionTest::SetUp();
97 policy_ = new ExtensionSpecialStoragePolicy(NULL); 94 policy_ = new ExtensionSpecialStoragePolicy(NULL);
98 } 95 }
99 96
100 scoped_refptr<Extension> CreateProtectedApp() { 97 scoped_refptr<Extension> CreateProtectedApp() {
101 #if defined(OS_WIN) 98 #if defined(OS_WIN)
102 base::FilePath path(FILE_PATH_LITERAL("c:\\foo")); 99 base::FilePath path(FILE_PATH_LITERAL("c:\\foo"));
103 #elif defined(OS_POSIX) 100 #elif defined(OS_POSIX)
104 base::FilePath path(FILE_PATH_LITERAL("/foo")); 101 base::FilePath path(FILE_PATH_LITERAL("/foo"));
105 #endif 102 #endif
106 DictionaryValue manifest; 103 DictionaryValue manifest;
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 EXPECT_TRUE(observer.IsCompleted()); 385 EXPECT_TRUE(observer.IsCompleted());
389 } 386 }
390 387
391 observer.ExpectClear(); 388 observer.ExpectClear();
392 policy_->RevokeRightsForAllExtensions(); 389 policy_->RevokeRightsForAllExtensions();
393 message_loop.RunUntilIdle(); 390 message_loop.RunUntilIdle();
394 EXPECT_TRUE(observer.IsCompleted()); 391 EXPECT_TRUE(observer.IsCompleted());
395 392
396 policy_->RemoveObserver(&observer); 393 policy_->RemoveObserver(&observer);
397 } 394 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_unittest.cc ('k') | chrome/browser/extensions/extension_ui_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698