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

Side by Side Diff: chrome/common/extensions/permissions/permissions_data_unittest.cc

Issue 1548153002: Switch to standard integer types in chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 <stdint.h>
6
5 #include <utility> 7 #include <utility>
6 #include <vector> 8 #include <vector>
7 9
8 #include "base/command_line.h" 10 #include "base/command_line.h"
9 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
10 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
11 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "build/build_config.h"
12 #include "chrome/common/extensions/extension_test_util.h" 15 #include "chrome/common/extensions/extension_test_util.h"
13 #include "components/crx_file/id_util.h" 16 #include "components/crx_file/id_util.h"
14 #include "content/public/common/socket_permission_request.h" 17 #include "content/public/common/socket_permission_request.h"
15 #include "extensions/common/error_utils.h" 18 #include "extensions/common/error_utils.h"
16 #include "extensions/common/extension.h" 19 #include "extensions/common/extension.h"
17 #include "extensions/common/extension_builder.h" 20 #include "extensions/common/extension_builder.h"
18 #include "extensions/common/manifest.h" 21 #include "extensions/common/manifest.h"
19 #include "extensions/common/manifest_constants.h" 22 #include "extensions/common/manifest_constants.h"
20 #include "extensions/common/permissions/api_permission.h" 23 #include "extensions/common/permissions/api_permission.h"
21 #include "extensions/common/permissions/permission_message_test_util.h" 24 #include "extensions/common/permissions/permission_message_test_util.h"
(...skipping 11 matching lines...) Expand all
33 using extension_test_util::LoadManifest; 36 using extension_test_util::LoadManifest;
34 using extension_test_util::LoadManifestUnchecked; 37 using extension_test_util::LoadManifestUnchecked;
35 using extension_test_util::LoadManifestStrict; 38 using extension_test_util::LoadManifestStrict;
36 39
37 namespace extensions { 40 namespace extensions {
38 41
39 namespace { 42 namespace {
40 43
41 const char kAllHostsPermission[] = "*://*/*"; 44 const char kAllHostsPermission[] = "*://*/*";
42 45
43 bool CheckSocketPermission( 46 bool CheckSocketPermission(scoped_refptr<Extension> extension,
44 scoped_refptr<Extension> extension, 47 SocketPermissionRequest::OperationType type,
45 SocketPermissionRequest::OperationType type, 48 const char* host,
46 const char* host, 49 uint16_t port) {
47 uint16 port) {
48 SocketPermission::CheckParam param(type, host, port); 50 SocketPermission::CheckParam param(type, host, port);
49 return extension->permissions_data()->CheckAPIPermissionWithParam( 51 return extension->permissions_data()->CheckAPIPermissionWithParam(
50 APIPermission::kSocket, &param); 52 APIPermission::kSocket, &param);
51 } 53 }
52 54
53 // Creates and returns an extension with the given |id|, |host_permissions|, and 55 // Creates and returns an extension with the given |id|, |host_permissions|, and
54 // manifest |location|. 56 // manifest |location|.
55 scoped_refptr<const Extension> GetExtensionWithHostPermission( 57 scoped_refptr<const Extension> GetExtensionWithHostPermission(
56 const std::string& id, 58 const std::string& id,
57 const std::string& host_permissions, 59 const std::string& host_permissions,
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
769 771
770 permissions_data->ClearTabSpecificPermissions(1); 772 permissions_data->ClearTabSpecificPermissions(1);
771 EXPECT_FALSE(permissions_data->GetTabSpecificPermissionsForTesting(1)); 773 EXPECT_FALSE(permissions_data->GetTabSpecificPermissionsForTesting(1));
772 774
773 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 0)); 775 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 0));
774 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 1)); 776 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 1));
775 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 2)); 777 EXPECT_TRUE(ScriptAllowedExclusivelyOnTab(extension.get(), no_urls, 2));
776 } 778 }
777 779
778 } // namespace extensions 780 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698