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

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

Issue 764643002: Remove WebViewKey in rules registry. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits. Created 6 years 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) 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_rules_registr y.h" 5 #include "extensions/browser/api/declarative_webrequest/webrequest_rules_registr y.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/json/json_reader.h" 11 #include "base/json/json_reader.h"
12 #include "base/memory/linked_ptr.h" 12 #include "base/memory/linked_ptr.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "base/stl_util.h" 15 #include "base/stl_util.h"
16 #include "base/test/values_test_util.h" 16 #include "base/test/values_test_util.h"
17 #include "base/values.h" 17 #include "base/values.h"
18 #include "chrome/common/extensions/extension_test_util.h" 18 #include "chrome/common/extensions/extension_test_util.h"
19 #include "components/url_matcher/url_matcher_constants.h" 19 #include "components/url_matcher/url_matcher_constants.h"
20 #include "content/public/test/test_browser_thread.h" 20 #include "content/public/test/test_browser_thread.h"
21 #include "extensions/browser/api/declarative/rules_registry_service.h"
21 #include "extensions/browser/api/declarative_webrequest/webrequest_constants.h" 22 #include "extensions/browser/api/declarative_webrequest/webrequest_constants.h"
22 #include "extensions/browser/api/web_request/web_request_api_helpers.h" 23 #include "extensions/browser/api/web_request/web_request_api_helpers.h"
23 #include "net/base/request_priority.h" 24 #include "net/base/request_priority.h"
24 #include "net/url_request/url_request.h" 25 #include "net/url_request/url_request.h"
25 #include "net/url_request/url_request_test_util.h" 26 #include "net/url_request/url_request_test_util.h"
26 #include "testing/gmock/include/gmock/gmock.h" 27 #include "testing/gmock/include/gmock/gmock.h"
27 #include "testing/gtest/include/gtest/gtest-message.h" 28 #include "testing/gtest/include/gtest/gtest-message.h"
28 #include "testing/gtest/include/gtest/gtest.h" 29 #include "testing/gtest/include/gtest/gtest.h"
29 30
30 using base::Value; 31 using base::Value;
(...skipping 12 matching lines...) Expand all
43 } // namespace 44 } // namespace
44 45
45 namespace extensions { 46 namespace extensions {
46 47
47 namespace helpers = extension_web_request_api_helpers; 48 namespace helpers = extension_web_request_api_helpers;
48 namespace keys = declarative_webrequest_constants; 49 namespace keys = declarative_webrequest_constants;
49 namespace keys2 = url_matcher::url_matcher_constants; 50 namespace keys2 = url_matcher::url_matcher_constants;
50 51
51 class TestWebRequestRulesRegistry : public WebRequestRulesRegistry { 52 class TestWebRequestRulesRegistry : public WebRequestRulesRegistry {
52 public: 53 public:
53 TestWebRequestRulesRegistry( 54 TestWebRequestRulesRegistry(scoped_refptr<InfoMap> extension_info_map)
54 scoped_refptr<InfoMap> extension_info_map)
55 : WebRequestRulesRegistry(NULL /*profile*/, 55 : WebRequestRulesRegistry(NULL /*profile*/,
56 NULL /* cache_delegate */, 56 NULL /* cache_delegate */,
57 WebViewKey(0, 0)), 57 RulesRegistryService::kDefaultRulesRegistryID),
58 num_clear_cache_calls_(0) { 58 num_clear_cache_calls_(0) {
59 SetExtensionInfoMapForTesting(extension_info_map); 59 SetExtensionInfoMapForTesting(extension_info_map);
60 } 60 }
61 61
62 // Returns how often the in-memory caches of the renderers were instructed 62 // Returns how often the in-memory caches of the renderers were instructed
63 // to be cleared. 63 // to be cleared.
64 int num_clear_cache_calls() const { return num_clear_cache_calls_; } 64 int num_clear_cache_calls() const { return num_clear_cache_calls_; }
65 65
66 // How many rules are there which have some conditions not triggered by URL 66 // How many rules are there which have some conditions not triggered by URL
67 // matches. 67 // matches.
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 // This is a correct match. 811 // This is a correct match.
812 GURL url2("http://foo.com/index.html"); 812 GURL url2("http://foo.com/index.html");
813 scoped_ptr<net::URLRequest> request2(context.CreateRequest( 813 scoped_ptr<net::URLRequest> request2(context.CreateRequest(
814 url2, net::DEFAULT_PRIORITY, NULL, NULL)); 814 url2, net::DEFAULT_PRIORITY, NULL, NULL));
815 WebRequestData request_data2(request2.get(), ON_BEFORE_REQUEST); 815 WebRequestData request_data2(request2.get(), ON_BEFORE_REQUEST);
816 deltas = registry->CreateDeltas(NULL, request_data2, false); 816 deltas = registry->CreateDeltas(NULL, request_data2, false);
817 EXPECT_EQ(1u, deltas.size()); 817 EXPECT_EQ(1u, deltas.size());
818 } 818 }
819 819
820 } // namespace extensions 820 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698