| 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_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" |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 | 636 |
| 637 const GURL urls[] = { | 637 const GURL urls[] = { |
| 638 GURL("http://url.example.com"), // matching | 638 GURL("http://url.example.com"), // matching |
| 639 GURL("http://www.example.com") // non-matching | 639 GURL("http://www.example.com") // non-matching |
| 640 }; | 640 }; |
| 641 const GURL firstPartyUrls[] = { | 641 const GURL firstPartyUrls[] = { |
| 642 GURL("http://www.example.com"), // non-matching | 642 GURL("http://www.example.com"), // non-matching |
| 643 GURL("http://fpfc.example.com") // matching | 643 GURL("http://fpfc.example.com") // matching |
| 644 }; | 644 }; |
| 645 // Which rules should match in subsequent test iterations. | 645 // Which rules should match in subsequent test iterations. |
| 646 const char* matchingRuleIds[] = { kRuleId1, kRuleId2 }; | 646 const char* const matchingRuleIds[] = { kRuleId1, kRuleId2 }; |
| 647 COMPILE_ASSERT(arraysize(urls) == arraysize(firstPartyUrls), | 647 COMPILE_ASSERT(arraysize(urls) == arraysize(firstPartyUrls), |
| 648 urls_and_firstPartyUrls_need_to_have_the_same_size); | 648 urls_and_firstPartyUrls_need_to_have_the_same_size); |
| 649 COMPILE_ASSERT(arraysize(urls) == arraysize(matchingRuleIds), | 649 COMPILE_ASSERT(arraysize(urls) == arraysize(matchingRuleIds), |
| 650 urls_and_matchingRuleIds_need_to_have_the_same_size); | 650 urls_and_matchingRuleIds_need_to_have_the_same_size); |
| 651 net::TestURLRequestContext context; | 651 net::TestURLRequestContext context; |
| 652 | 652 |
| 653 for (size_t i = 0; i < arraysize(matchingRuleIds); ++i) { | 653 for (size_t i = 0; i < arraysize(matchingRuleIds); ++i) { |
| 654 // Construct the inputs. | 654 // Construct the inputs. |
| 655 scoped_ptr<net::URLRequest> http_request(context.CreateRequest( | 655 scoped_ptr<net::URLRequest> http_request(context.CreateRequest( |
| 656 urls[i], net::DEFAULT_PRIORITY, NULL, NULL)); | 656 urls[i], net::DEFAULT_PRIORITY, NULL, NULL)); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |