| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 pdf_path_, &info); | 86 pdf_path_, &info); |
| 87 } else if (!is_loaded && want_loaded) { | 87 } else if (!is_loaded && want_loaded) { |
| 88 // This "loads" the plug-in even if it's not present on the | 88 // This "loads" the plug-in even if it's not present on the |
| 89 // system - which is OK since we don't actually use it, just | 89 // system - which is OK since we don't actually use it, just |
| 90 // need it to be "enabled" for the test. | 90 // need it to be "enabled" for the test. |
| 91 RegisterPDFPlugin(); | 91 RegisterPDFPlugin(); |
| 92 is_loaded = webkit::npapi::PluginList::Singleton()->GetPluginInfoByPath( | 92 is_loaded = webkit::npapi::PluginList::Singleton()->GetPluginInfoByPath( |
| 93 pdf_path_, &info); | 93 pdf_path_, &info); |
| 94 } | 94 } |
| 95 EXPECT_EQ(want_loaded, is_loaded); | 95 EXPECT_EQ(want_loaded, is_loaded); |
| 96 *out_is_enabled = info.enabled; | 96 *out_is_enabled = webkit::npapi::IsPluginEnabled(info); |
| 97 } | 97 } |
| 98 | 98 |
| 99 protected: | 99 protected: |
| 100 MessageLoopForIO message_loop_; | 100 MessageLoopForIO message_loop_; |
| 101 TestDelegate test_delegate_; | 101 TestDelegate test_delegate_; |
| 102 net::URLRequest::Interceptor* interceptor_; | 102 net::URLRequest::Interceptor* interceptor_; |
| 103 FilePath pdf_path_; | 103 FilePath pdf_path_; |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 TEST_F(GViewRequestInterceptorTest, DoNotInterceptHtml) { | 106 TEST_F(GViewRequestInterceptorTest, DoNotInterceptHtml) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 TEST_F(GViewRequestInterceptorTest, InterceptPowerpoint) { | 171 TEST_F(GViewRequestInterceptorTest, InterceptPowerpoint) { |
| 172 net::URLRequest request(GURL("http://foo.com/file.ppt"), &test_delegate_); | 172 net::URLRequest request(GURL("http://foo.com/file.ppt"), &test_delegate_); |
| 173 request.Start(); | 173 request.Start(); |
| 174 MessageLoop::current()->Run(); | 174 MessageLoop::current()->Run(); |
| 175 EXPECT_EQ(1, test_delegate_.received_redirect_count()); | 175 EXPECT_EQ(1, test_delegate_.received_redirect_count()); |
| 176 EXPECT_EQ(GURL("http://docs.google.com/gview?url=http%3A//foo.com/file.ppt"), | 176 EXPECT_EQ(GURL("http://docs.google.com/gview?url=http%3A//foo.com/file.ppt"), |
| 177 request.url()); | 177 request.url()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 } // namespace chromeos | 180 } // namespace chromeos |
| OLD | NEW |