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

Side by Side Diff: chrome/browser/extensions/api/api_resource_manager_unittest.cc

Issue 12212047: Linux/ChromeOS Chromium style checker cleanup, chrome/browser/extensions edition. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 10 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/file_path.h" 5 #include "base/file_path.h"
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 #include "chrome/browser/extensions/api/api_resource.h" 7 #include "chrome/browser/extensions/api/api_resource.h"
8 #include "chrome/browser/extensions/api/api_resource_manager.h" 8 #include "chrome/browser/extensions/api/api_resource_manager.h"
9 #include "chrome/browser/extensions/extension_function_test_utils.h" 9 #include "chrome/browser/extensions/extension_function_test_utils.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
(...skipping 14 matching lines...) Expand all
25 public: 25 public:
26 virtual void SetUp() { 26 virtual void SetUp() {
27 BrowserWithTestWindowTest::SetUp(); 27 BrowserWithTestWindowTest::SetUp();
28 } 28 }
29 }; 29 };
30 30
31 class FakeApiResource : public ApiResource { 31 class FakeApiResource : public ApiResource {
32 public: 32 public:
33 FakeApiResource(const std::string& owner_extension_id) : 33 FakeApiResource(const std::string& owner_extension_id) :
34 ApiResource(owner_extension_id) {} 34 ApiResource(owner_extension_id) {}
35 ~FakeApiResource() {} 35 virtual ~FakeApiResource() {}
36 }; 36 };
37 37
38 TEST_F(ApiResourceManagerUnitTest, TwoAppsCannotShareResources) { 38 TEST_F(ApiResourceManagerUnitTest, TwoAppsCannotShareResources) {
39 scoped_ptr<ApiResourceManager<FakeApiResource> > manager( 39 scoped_ptr<ApiResourceManager<FakeApiResource> > manager(
40 new ApiResourceManager<FakeApiResource>(BrowserThread::UI)); 40 new ApiResourceManager<FakeApiResource>(BrowserThread::UI));
41 scoped_refptr<extensions::Extension> extension_one( 41 scoped_refptr<extensions::Extension> extension_one(
42 utils::CreateEmptyExtension("one")); 42 utils::CreateEmptyExtension("one"));
43 scoped_refptr<extensions::Extension> extension_two( 43 scoped_refptr<extensions::Extension> extension_two(
44 utils::CreateEmptyExtension("two")); 44 utils::CreateEmptyExtension("two"));
45 45
(...skipping 11 matching lines...) Expand all
57 57
58 // Confirm neither extension can get the other's resource. 58 // Confirm neither extension can get the other's resource.
59 ASSERT_TRUE(manager->Get(extension_one_id, resource_two_id) == NULL); 59 ASSERT_TRUE(manager->Get(extension_one_id, resource_two_id) == NULL);
60 ASSERT_TRUE(manager->Get(extension_two_id, resource_one_id) == NULL); 60 ASSERT_TRUE(manager->Get(extension_two_id, resource_one_id) == NULL);
61 61
62 // And make sure we're not susceptible to any Jedi mind tricks. 62 // And make sure we're not susceptible to any Jedi mind tricks.
63 ASSERT_TRUE(manager->Get(std::string(), resource_one_id) == NULL); 63 ASSERT_TRUE(manager->Get(std::string(), resource_one_id) == NULL);
64 } 64 }
65 65
66 } // namespace extensions 66 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/alarms/alarms_api_unittest.cc ('k') | chrome/browser/extensions/api/app/app_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698