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

Side by Side Diff: chrome/browser/extensions/api/declarative_webrequest/webrequest_action_unittest.cc

Issue 63933003: Moved ExtensionInfoMap and ExtensionsQuotaService to extensions/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment fix Created 7 years, 1 month 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/declarative_webrequest/webrequest_action .h" 5 #include "chrome/browser/extensions/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"
11 #include "base/message_loop/message_loop.h" 11 #include "base/message_loop/message_loop.h"
12 #include "base/path_service.h" 12 #include "base/path_service.h"
13 #include "base/test/values_test_util.h" 13 #include "base/test/values_test_util.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "base/values.h" 15 #include "base/values.h"
16 #include "chrome/browser/extensions/api/declarative_webrequest/request_stage.h" 16 #include "chrome/browser/extensions/api/declarative_webrequest/request_stage.h"
17 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_condit ion.h" 17 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_condit ion.h"
18 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta nts.h" 18 #include "chrome/browser/extensions/api/declarative_webrequest/webrequest_consta nts.h"
19 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h" 19 #include "chrome/browser/extensions/api/web_request/web_request_api_helpers.h"
20 #include "chrome/browser/extensions/extension_info_map.h"
21 #include "chrome/common/chrome_paths.h" 20 #include "chrome/common/chrome_paths.h"
22 #include "chrome/common/extensions/extension.h" 21 #include "chrome/common/extensions/extension.h"
23 #include "chrome/common/extensions/extension_constants.h" 22 #include "chrome/common/extensions/extension_constants.h"
24 #include "chrome/common/extensions/extension_test_util.h" 23 #include "chrome/common/extensions/extension_test_util.h"
25 #include "content/public/test/test_browser_thread_bundle.h" 24 #include "content/public/test/test_browser_thread_bundle.h"
25 #include "extensions/browser/info_map.h"
26 #include "net/base/request_priority.h" 26 #include "net/base/request_priority.h"
27 #include "net/http/http_response_headers.h" 27 #include "net/http/http_response_headers.h"
28 #include "net/url_request/url_request_test_util.h" 28 #include "net/url_request/url_request_test_util.h"
29 #include "testing/gmock/include/gmock/gmock.h" 29 #include "testing/gmock/include/gmock/gmock.h"
30 #include "testing/gtest/include/gtest/gtest.h" 30 #include "testing/gtest/include/gtest/gtest.h"
31 31
32 using base::DictionaryValue; 32 using base::DictionaryValue;
33 using base::ListValue; 33 using base::ListValue;
34 using extension_test_util::LoadManifestUnchecked; 34 using extension_test_util::LoadManifestUnchecked;
35 using testing::HasSubstr; 35 using testing::HasSubstr;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 net::TestURLRequestContext context_; 94 net::TestURLRequestContext context_;
95 95
96 // An extension with *.com host permissions and the DWR permission. 96 // An extension with *.com host permissions and the DWR permission.
97 scoped_refptr<Extension> extension_; 97 scoped_refptr<Extension> extension_;
98 // An extension with host permissions for all URLs and the DWR permission. 98 // An extension with host permissions for all URLs and the DWR permission.
99 scoped_refptr<Extension> extension_all_urls_; 99 scoped_refptr<Extension> extension_all_urls_;
100 scoped_refptr<ExtensionInfoMap> extension_info_map_; 100 scoped_refptr<InfoMap> extension_info_map_;
101 101
102 private: 102 private:
103 content::TestBrowserThreadBundle thread_bundle_; 103 content::TestBrowserThreadBundle thread_bundle_;
104 }; 104 };
105 105
106 void WebRequestActionWithThreadsTest::SetUp() { 106 void WebRequestActionWithThreadsTest::SetUp() {
107 testing::Test::SetUp(); 107 testing::Test::SetUp();
108 108
109 std::string error; 109 std::string error;
110 extension_ = LoadManifestUnchecked("permissions", 110 extension_ = LoadManifestUnchecked("permissions",
111 "web_request_com_host_permissions.json", 111 "web_request_com_host_permissions.json",
112 Manifest::INVALID_LOCATION, 112 Manifest::INVALID_LOCATION,
113 Extension::NO_FLAGS, 113 Extension::NO_FLAGS,
114 "ext_id_1", 114 "ext_id_1",
115 &error); 115 &error);
116 ASSERT_TRUE(extension_.get()) << error; 116 ASSERT_TRUE(extension_.get()) << error;
117 extension_all_urls_ = 117 extension_all_urls_ =
118 LoadManifestUnchecked("permissions", 118 LoadManifestUnchecked("permissions",
119 "web_request_all_host_permissions.json", 119 "web_request_all_host_permissions.json",
120 Manifest::INVALID_LOCATION, 120 Manifest::INVALID_LOCATION,
121 Extension::NO_FLAGS, 121 Extension::NO_FLAGS,
122 "ext_id_2", 122 "ext_id_2",
123 &error); 123 &error);
124 ASSERT_TRUE(extension_all_urls_.get()) << error; 124 ASSERT_TRUE(extension_all_urls_.get()) << error;
125 extension_info_map_ = new ExtensionInfoMap; 125 extension_info_map_ = new InfoMap;
126 ASSERT_TRUE(extension_info_map_.get()); 126 ASSERT_TRUE(extension_info_map_.get());
127 extension_info_map_->AddExtension( 127 extension_info_map_->AddExtension(
128 extension_.get(), base::Time::Now(), false /*incognito_enabled*/); 128 extension_.get(), base::Time::Now(), false /*incognito_enabled*/);
129 extension_info_map_->AddExtension(extension_all_urls_.get(), 129 extension_info_map_->AddExtension(extension_all_urls_.get(),
130 base::Time::Now(), 130 base::Time::Now(),
131 false /*incognito_enabled*/); 131 false /*incognito_enabled*/);
132 } 132 }
133 133
134 bool WebRequestActionWithThreadsTest::ActionWorksOnRequest( 134 bool WebRequestActionWithThreadsTest::ActionWorksOnRequest(
135 const char* url_string, 135 const char* url_string,
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 for (WebRequestActionSet::Actions::const_iterator it = 568 for (WebRequestActionSet::Actions::const_iterator it =
569 action_set->actions().begin(); 569 action_set->actions().begin();
570 it != action_set->actions().end(); 570 it != action_set->actions().end();
571 ++it) { 571 ++it) {
572 EXPECT_EQ(kExpectedNames[index], (*it)->GetName()); 572 EXPECT_EQ(kExpectedNames[index], (*it)->GetName());
573 ++index; 573 ++index;
574 } 574 }
575 } 575 }
576 576
577 } // namespace extensions 577 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698