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 "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" |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 " \"instanceType\": \"declarativeWebRequest.RedirectToTransparentImage\"" | 535 " \"instanceType\": \"declarativeWebRequest.RedirectToTransparentImage\"" |
536 "}," | 536 "}," |
537 "{" | 537 "{" |
538 " \"instanceType\": \"declarativeWebRequest.RedirectToEmptyDocument\"" | 538 " \"instanceType\": \"declarativeWebRequest.RedirectToEmptyDocument\"" |
539 "}," | 539 "}," |
540 "{" | 540 "{" |
541 " \"instanceType\": \"declarativeWebRequest.IgnoreRules\"," | 541 " \"instanceType\": \"declarativeWebRequest.IgnoreRules\"," |
542 " \"lowerPriorityThan\": 123," | 542 " \"lowerPriorityThan\": 123," |
543 " \"hasTag\": \"some_tag\"" | 543 " \"hasTag\": \"some_tag\"" |
544 "}]"; | 544 "}]"; |
| 545 const char* kExpectedNames[] = { |
| 546 "declarativeWebRequest.RedirectRequest", |
| 547 "declarativeWebRequest.RedirectByRegEx", |
| 548 "declarativeWebRequest.SetRequestHeader", |
| 549 "declarativeWebRequest.RemoveRequestHeader", |
| 550 "declarativeWebRequest.AddResponseHeader", |
| 551 "declarativeWebRequest.RemoveResponseHeader", |
| 552 "declarativeWebRequest.SendMessageToExtension", |
| 553 "declarativeWebRequest.AddRequestCookie", |
| 554 "declarativeWebRequest.AddResponseCookie", |
| 555 "declarativeWebRequest.EditRequestCookie", |
| 556 "declarativeWebRequest.EditResponseCookie", |
| 557 "declarativeWebRequest.RemoveRequestCookie", |
| 558 "declarativeWebRequest.RemoveResponseCookie", |
| 559 "declarativeWebRequest.CancelRequest", |
| 560 "declarativeWebRequest.RedirectToTransparentImage", |
| 561 "declarativeWebRequest.RedirectToEmptyDocument", |
| 562 "declarativeWebRequest.IgnoreRules", |
| 563 }; |
545 scoped_ptr<WebRequestActionSet> action_set(CreateSetOfActions(kActions)); | 564 scoped_ptr<WebRequestActionSet> action_set(CreateSetOfActions(kActions)); |
| 565 ASSERT_EQ(arraysize(kExpectedNames), action_set->actions().size()); |
| 566 size_t index = 0; |
546 for (WebRequestActionSet::Actions::const_iterator it = | 567 for (WebRequestActionSet::Actions::const_iterator it = |
547 action_set->actions().begin(); | 568 action_set->actions().begin(); |
548 it != action_set->actions().end(); | 569 it != action_set->actions().end(); |
549 ++it) { | 570 ++it) { |
550 EXPECT_THAT((*it)->GetName(), HasSubstr("declarativeWebRequest.")); | 571 EXPECT_EQ(kExpectedNames[index], (*it)->GetName()); |
| 572 ++index; |
551 } | 573 } |
552 } | 574 } |
553 | 575 |
554 } // namespace extensions | 576 } // namespace extensions |
OLD | NEW |