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

Side by Side Diff: extensions/browser/api/declarative_webrequest/webrequest_condition_attribute_unittest.cc

Issue 694773003: Allow URL requests for object/embed tags to be intercepted as streams. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@refactor-guest-view-container-3
Patch Set: Created 6 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
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_condition_att ribute.h" 5 #include "extensions/browser/api/declarative_webrequest/webrequest_condition_att ribute.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 GURL("http://www.example.com"), net::DEFAULT_PRIORITY, NULL, NULL)); 101 GURL("http://www.example.com"), net::DEFAULT_PRIORITY, NULL, NULL));
102 content::ResourceRequestInfo::AllocateForTesting( 102 content::ResourceRequestInfo::AllocateForTesting(
103 url_request_ok.get(), 103 url_request_ok.get(),
104 content::RESOURCE_TYPE_SUB_FRAME, 104 content::RESOURCE_TYPE_SUB_FRAME,
105 NULL, // context 105 NULL, // context
106 -1, // render_process_id 106 -1, // render_process_id
107 -1, // render_view_id 107 -1, // render_view_id
108 -1, // render_frame_id 108 -1, // render_frame_id
109 false, // is_main_frame 109 false, // is_main_frame
110 false, // parent_is_main_frame 110 false, // parent_is_main_frame
111 true, // allow_download
111 false); // is_async 112 false); // is_async
112 EXPECT_TRUE(attribute->IsFulfilled(WebRequestData(url_request_ok.get(), 113 EXPECT_TRUE(attribute->IsFulfilled(WebRequestData(url_request_ok.get(),
113 ON_BEFORE_REQUEST))); 114 ON_BEFORE_REQUEST)));
114 115
115 scoped_ptr<net::URLRequest> url_request_fail(context.CreateRequest( 116 scoped_ptr<net::URLRequest> url_request_fail(context.CreateRequest(
116 GURL("http://www.example.com"), net::DEFAULT_PRIORITY, NULL, NULL)); 117 GURL("http://www.example.com"), net::DEFAULT_PRIORITY, NULL, NULL));
117 content::ResourceRequestInfo::AllocateForTesting( 118 content::ResourceRequestInfo::AllocateForTesting(
118 url_request_fail.get(), 119 url_request_fail.get(),
119 content::RESOURCE_TYPE_MAIN_FRAME, 120 content::RESOURCE_TYPE_MAIN_FRAME,
120 NULL, // context 121 NULL, // context
121 -1, // render_process_id 122 -1, // render_process_id
122 -1, // render_view_id 123 -1, // render_view_id
123 -1, // render_frame_id 124 -1, // render_frame_id
124 true, // is_main_frame 125 true, // is_main_frame
125 false, // parent_is_main_frame 126 false, // parent_is_main_frame
127 true, // allow_download
126 false); // is_async 128 false); // is_async
127 EXPECT_FALSE(attribute->IsFulfilled(WebRequestData(url_request_fail.get(), 129 EXPECT_FALSE(attribute->IsFulfilled(WebRequestData(url_request_fail.get(),
128 ON_BEFORE_REQUEST))); 130 ON_BEFORE_REQUEST)));
129 } 131 }
130 132
131 TEST(WebRequestConditionAttributeTest, ContentType) { 133 TEST(WebRequestConditionAttributeTest, ContentType) {
132 // Necessary for TestURLRequest. 134 // Necessary for TestURLRequest.
133 base::MessageLoopForIO message_loop; 135 base::MessageLoopForIO message_loop;
134 136
135 std::string error; 137 std::string error;
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 }; 716 };
715 const size_t kExistingSize[] = { arraysize(kExisting) }; 717 const size_t kExistingSize[] = { arraysize(kExisting) };
716 GetArrayAsVector(kExisting, kExistingSize, 1u, &tests); 718 GetArrayAsVector(kExisting, kExistingSize, 1u, &tests);
717 MatchAndCheck(tests, keys::kExcludeResponseHeadersKey, stage, 719 MatchAndCheck(tests, keys::kExcludeResponseHeadersKey, stage,
718 url_request.get(), &result); 720 url_request.get(), &result);
719 EXPECT_FALSE(result); 721 EXPECT_FALSE(result);
720 } 722 }
721 723
722 } // namespace 724 } // namespace
723 } // namespace extensions 725 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698