| 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 "extensions/browser/api/declarative_webrequest/webrequest_action.h" | 5 #include "extensions/browser/api/declarative_webrequest/webrequest_action.h" |
| 6 | 6 |
| 7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 const std::string& extension_id, | 84 const std::string& extension_id, |
| 85 const WebRequestActionSet* action_set, | 85 const WebRequestActionSet* action_set, |
| 86 RequestStage stage); | 86 RequestStage stage); |
| 87 | 87 |
| 88 // Expects a JSON description of an |action| requiring <all_urls> host | 88 // Expects a JSON description of an |action| requiring <all_urls> host |
| 89 // permission, and checks that only an extensions with full host permissions | 89 // permission, and checks that only an extensions with full host permissions |
| 90 // can execute that action at |stage|. Also checks that the action is not | 90 // can execute that action at |stage|. Also checks that the action is not |
| 91 // executable for http://clients1.google.com. | 91 // executable for http://clients1.google.com. |
| 92 void CheckActionNeedsAllUrls(const char* action, RequestStage stage); | 92 void CheckActionNeedsAllUrls(const char* action, RequestStage stage); |
| 93 | 93 |
| 94 private: |
| 95 content::TestBrowserThreadBundle thread_bundle_; |
| 96 |
| 97 protected: |
| 94 net::TestURLRequestContext context_; | 98 net::TestURLRequestContext context_; |
| 95 | 99 |
| 96 // An extension with *.com host permissions and the DWR permission. | 100 // An extension with *.com host permissions and the DWR permission. |
| 97 scoped_refptr<Extension> extension_; | 101 scoped_refptr<Extension> extension_; |
| 98 // An extension with host permissions for all URLs and the DWR permission. | 102 // An extension with host permissions for all URLs and the DWR permission. |
| 99 scoped_refptr<Extension> extension_all_urls_; | 103 scoped_refptr<Extension> extension_all_urls_; |
| 100 scoped_refptr<InfoMap> extension_info_map_; | 104 scoped_refptr<InfoMap> extension_info_map_; |
| 101 | |
| 102 private: | |
| 103 content::TestBrowserThreadBundle thread_bundle_; | |
| 104 }; | 105 }; |
| 105 | 106 |
| 106 void WebRequestActionWithThreadsTest::SetUp() { | 107 void WebRequestActionWithThreadsTest::SetUp() { |
| 107 testing::Test::SetUp(); | 108 testing::Test::SetUp(); |
| 108 | 109 |
| 109 std::string error; | 110 std::string error; |
| 110 extension_ = LoadManifestUnchecked("permissions", | 111 extension_ = LoadManifestUnchecked("permissions", |
| 111 "web_request_com_host_permissions.json", | 112 "web_request_com_host_permissions.json", |
| 112 Manifest::INVALID_LOCATION, | 113 Manifest::INVALID_LOCATION, |
| 113 Extension::NO_FLAGS, | 114 Extension::NO_FLAGS, |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 for (WebRequestActionSet::Actions::const_iterator it = | 583 for (WebRequestActionSet::Actions::const_iterator it = |
| 583 action_set->actions().begin(); | 584 action_set->actions().begin(); |
| 584 it != action_set->actions().end(); | 585 it != action_set->actions().end(); |
| 585 ++it) { | 586 ++it) { |
| 586 EXPECT_EQ(kExpectedNames[index], (*it)->GetName()); | 587 EXPECT_EQ(kExpectedNames[index], (*it)->GetName()); |
| 587 ++index; | 588 ++index; |
| 588 } | 589 } |
| 589 } | 590 } |
| 590 | 591 |
| 591 } // namespace extensions | 592 } // namespace extensions |
| OLD | NEW |