OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/process_util.h" | 9 #include "base/process_util.h" |
10 #include "chrome/browser/browser_thread.h" | 10 #include "chrome/browser/browser_thread.h" |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 "chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/popup.html")); | 995 "chrome-extension://behllobkkfkfnphdnhnkndlbkcpglgmj/popup.html")); |
996 resource_type_ = ResourceType::STYLESHEET; | 996 resource_type_ = ResourceType::STYLESHEET; |
997 resource_handler_.reset(new DummyResourceHandler()); | 997 resource_handler_.reset(new DummyResourceHandler()); |
998 request_info_.reset(CreateNewResourceRequestInfo()); | 998 request_info_.reset(CreateNewResourceRequestInfo()); |
999 } | 999 } |
1000 | 1000 |
1001 ResourceDispatcherHostRequestInfo* CreateNewResourceRequestInfo() { | 1001 ResourceDispatcherHostRequestInfo* CreateNewResourceRequestInfo() { |
1002 return new ResourceDispatcherHostRequestInfo( | 1002 return new ResourceDispatcherHostRequestInfo( |
1003 resource_handler_.get(), ChildProcessInfo::RENDER_PROCESS, 0, 0, 0, | 1003 resource_handler_.get(), ChildProcessInfo::RENDER_PROCESS, 0, 0, 0, |
1004 "not important", "not important", | 1004 "not important", "not important", |
1005 ResourceType::STYLESHEET, 0U, false, false, -1, -1); | 1005 ResourceType::STYLESHEET, 0U, false, false, false, -1, -1); |
1006 } | 1006 } |
1007 | 1007 |
1008 scoped_ptr<GURL> url_; | 1008 scoped_ptr<GURL> url_; |
1009 ResourceType::Type resource_type_; | 1009 ResourceType::Type resource_type_; |
1010 scoped_ptr<DummyResourceHandler> resource_handler_; | 1010 scoped_ptr<DummyResourceHandler> resource_handler_; |
1011 scoped_ptr<ResourceDispatcherHostRequestInfo> request_info_; | 1011 scoped_ptr<ResourceDispatcherHostRequestInfo> request_info_; |
1012 }; | 1012 }; |
1013 | 1013 |
1014 TEST_F(ApplyExtensionLocalizationFilterTest, WrongScheme) { | 1014 TEST_F(ApplyExtensionLocalizationFilterTest, WrongScheme) { |
1015 url_.reset(new GURL("html://behllobkkfkfnphdnhnkndlbkcpglgmj/popup.html")); | 1015 url_.reset(new GURL("html://behllobkkfkfnphdnhnkndlbkcpglgmj/popup.html")); |
(...skipping 10 matching lines...) Expand all Loading... |
1026 EXPECT_TRUE(request_info_->replace_extension_localization_templates()); | 1026 EXPECT_TRUE(request_info_->replace_extension_localization_templates()); |
1027 } | 1027 } |
1028 | 1028 |
1029 TEST_F(ApplyExtensionLocalizationFilterTest, GoodSchemeWrongResourceType) { | 1029 TEST_F(ApplyExtensionLocalizationFilterTest, GoodSchemeWrongResourceType) { |
1030 resource_type_ = ResourceType::MAIN_FRAME; | 1030 resource_type_ = ResourceType::MAIN_FRAME; |
1031 ResourceDispatcherHost::ApplyExtensionLocalizationFilter(*url_, | 1031 ResourceDispatcherHost::ApplyExtensionLocalizationFilter(*url_, |
1032 resource_type_, request_info_.get()); | 1032 resource_type_, request_info_.get()); |
1033 | 1033 |
1034 EXPECT_FALSE(request_info_->replace_extension_localization_templates()); | 1034 EXPECT_FALSE(request_info_->replace_extension_localization_templates()); |
1035 } | 1035 } |
OLD | NEW |