OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <string> | 5 #include <string> |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "chrome/browser/chromeos/gview_request_interceptor.h" | 7 #include "chrome/browser/chromeos/gview_request_interceptor.h" |
8 #include "chrome/browser/plugin_service.h" | 8 #include "chrome/browser/plugin_service.h" |
9 #include "chrome/common/chrome_paths.h" | 9 #include "chrome/common/chrome_paths.h" |
10 #include "net/base/load_flags.h" | 10 #include "net/base/load_flags.h" |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 EXPECT_EQ(0, test_delegate_.received_redirect_count()); | 138 EXPECT_EQ(0, test_delegate_.received_redirect_count()); |
139 EXPECT_EQ(GURL("http://foo.com/file.pdf"), request.url()); | 139 EXPECT_EQ(GURL("http://foo.com/file.pdf"), request.url()); |
140 } | 140 } |
141 | 141 |
142 TEST_F(GViewRequestInterceptorTest, InterceptPdfWhenDisabled) { | 142 TEST_F(GViewRequestInterceptorTest, InterceptPdfWhenDisabled) { |
143 bool enabled; | 143 bool enabled; |
144 SetPDFPluginLoadedState(true, &enabled); | 144 SetPDFPluginLoadedState(true, &enabled); |
145 | 145 |
146 if (enabled) { | 146 if (enabled) { |
147 bool pdf_plugin_disabled = | 147 bool pdf_plugin_disabled = |
148 NPAPI::PluginList::Singleton()->DisablePlugin(pdf_path_); | 148 NPAPI::PluginList::Singleton()->DisablePlugin(pdf_path_, false); |
149 EXPECT_TRUE(pdf_plugin_disabled); | 149 EXPECT_TRUE(pdf_plugin_disabled); |
150 } | 150 } |
151 | 151 |
152 net::URLRequest request(GURL("http://foo.com/file.pdf"), &test_delegate_); | 152 net::URLRequest request(GURL("http://foo.com/file.pdf"), &test_delegate_); |
153 request.Start(); | 153 request.Start(); |
154 MessageLoop::current()->Run(); | 154 MessageLoop::current()->Run(); |
155 EXPECT_EQ(1, test_delegate_.received_redirect_count()); | 155 EXPECT_EQ(1, test_delegate_.received_redirect_count()); |
156 EXPECT_EQ( | 156 EXPECT_EQ( |
157 GURL("http://docs.google.com/gview?url=http%3A//foo.com/file.pdf"), | 157 GURL("http://docs.google.com/gview?url=http%3A//foo.com/file.pdf"), |
158 request.url()); | 158 request.url()); |
(...skipping 14 matching lines...) Expand all Loading... |
173 TEST_F(GViewRequestInterceptorTest, InterceptPowerpoint) { | 173 TEST_F(GViewRequestInterceptorTest, InterceptPowerpoint) { |
174 net::URLRequest request(GURL("http://foo.com/file.ppt"), &test_delegate_); | 174 net::URLRequest request(GURL("http://foo.com/file.ppt"), &test_delegate_); |
175 request.Start(); | 175 request.Start(); |
176 MessageLoop::current()->Run(); | 176 MessageLoop::current()->Run(); |
177 EXPECT_EQ(1, test_delegate_.received_redirect_count()); | 177 EXPECT_EQ(1, test_delegate_.received_redirect_count()); |
178 EXPECT_EQ(GURL("http://docs.google.com/gview?url=http%3A//foo.com/file.ppt"), | 178 EXPECT_EQ(GURL("http://docs.google.com/gview?url=http%3A//foo.com/file.ppt"), |
179 request.url()); | 179 request.url()); |
180 } | 180 } |
181 | 181 |
182 } // namespace chromeos | 182 } // namespace chromeos |
OLD | NEW |