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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_permissions_unittest.cc

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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 "chrome/browser/extensions/api/web_request/web_request_permissions.h" 5 #include "chrome/browser/extensions/api/web_request/web_request_permissions.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "chrome/browser/extensions/extension_info_map.h" 8 #include "chrome/browser/extensions/extension_info_map.h"
9 #include "chrome/common/extensions/extension_constants.h" 9 #include "chrome/common/extensions/extension_constants.h"
10 #include "chrome/common/extensions/extension_manifest_constants.h" 10 #include "chrome/common/extensions/extension_manifest_constants.h"
(...skipping 20 matching lines...) Expand all
31 protected: 31 protected:
32 net::TestURLRequestContext context; 32 net::TestURLRequestContext context;
33 33
34 // This extension has Web Request permissions, but no host permission. 34 // This extension has Web Request permissions, but no host permission.
35 scoped_refptr<Extension> permissionless_extension_; 35 scoped_refptr<Extension> permissionless_extension_;
36 // This extension has Web Request permissions, and *.com a host permission. 36 // This extension has Web Request permissions, and *.com a host permission.
37 scoped_refptr<Extension> com_extension_; 37 scoped_refptr<Extension> com_extension_;
38 scoped_refptr<ExtensionInfoMap> extension_info_map_; 38 scoped_refptr<ExtensionInfoMap> extension_info_map_;
39 39
40 private: 40 private:
41 MessageLoopForIO message_loop_; 41 base::MessageLoopForIO message_loop_;
42 content::TestBrowserThread io_thread_; 42 content::TestBrowserThread io_thread_;
43 }; 43 };
44 44
45 void ExtensionWebRequestHelpersTestWithThreadsTest::SetUp() { 45 void ExtensionWebRequestHelpersTestWithThreadsTest::SetUp() {
46 testing::Test::SetUp(); 46 testing::Test::SetUp();
47 47
48 std::string error; 48 std::string error;
49 permissionless_extension_ = LoadManifestUnchecked("permissions", 49 permissionless_extension_ = LoadManifestUnchecked("permissions",
50 "web_request_no_host.json", 50 "web_request_no_host.json",
51 Manifest::INVALID_LOCATION, 51 Manifest::INVALID_LOCATION,
(...skipping 11 matching lines...) Expand all
63 ASSERT_TRUE(com_extension_) << error; 63 ASSERT_TRUE(com_extension_) << error;
64 extension_info_map_ = new ExtensionInfoMap; 64 extension_info_map_ = new ExtensionInfoMap;
65 extension_info_map_->AddExtension(permissionless_extension_.get(), 65 extension_info_map_->AddExtension(permissionless_extension_.get(),
66 base::Time::Now(), 66 base::Time::Now(),
67 false /*incognito_enabled*/); 67 false /*incognito_enabled*/);
68 extension_info_map_->AddExtension( 68 extension_info_map_->AddExtension(
69 com_extension_.get(), base::Time::Now(), false /*incognito_enabled*/); 69 com_extension_.get(), base::Time::Now(), false /*incognito_enabled*/);
70 } 70 }
71 71
72 TEST(ExtensionWebRequestHelpersTest, TestHideRequestForURL) { 72 TEST(ExtensionWebRequestHelpersTest, TestHideRequestForURL) {
73 MessageLoopForIO message_loop; 73 base::MessageLoopForIO message_loop;
74 net::TestURLRequestContext context; 74 net::TestURLRequestContext context;
75 scoped_refptr<ExtensionInfoMap> extension_info_map(new ExtensionInfoMap); 75 scoped_refptr<ExtensionInfoMap> extension_info_map(new ExtensionInfoMap);
76 const char* sensitive_urls[] = { 76 const char* sensitive_urls[] = {
77 "http://clients2.google.com", 77 "http://clients2.google.com",
78 "http://clients22.google.com", 78 "http://clients22.google.com",
79 "https://clients2.google.com", 79 "https://clients2.google.com",
80 "http://clients2.google.com/service/update2/crx", 80 "http://clients2.google.com/service/update2/crx",
81 "https://clients.google.com", 81 "https://clients.google.com",
82 "https://test.clients.google.com", 82 "https://test.clients.google.com",
83 "https://clients2.google.com/service/update2/crx", 83 "https://clients2.google.com/service/update2/crx",
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 request.url(), 166 request.url(),
167 false /*crosses_incognito*/, 167 false /*crosses_incognito*/,
168 WebRequestPermissions::REQUIRE_HOST_PERMISSION)); 168 WebRequestPermissions::REQUIRE_HOST_PERMISSION));
169 EXPECT_FALSE(WebRequestPermissions::CanExtensionAccessURL( 169 EXPECT_FALSE(WebRequestPermissions::CanExtensionAccessURL(
170 extension_info_map_, 170 extension_info_map_,
171 com_extension_->id(), 171 com_extension_->id(),
172 request.url(), 172 request.url(),
173 false /*crosses_incognito*/, 173 false /*crosses_incognito*/,
174 WebRequestPermissions::REQUIRE_ALL_URLS)); 174 WebRequestPermissions::REQUIRE_ALL_URLS));
175 } 175 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698