| 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 <vector> |
| 6 | 7 |
| 7 #include "base/bind.h" | 8 #include "base/bind.h" |
| 8 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 9 #include "chrome/browser/chrome_plugin_service_filter.h" | 10 #include "chrome/browser/chrome_plugin_service_filter.h" |
| 10 #include "chrome/browser/chromeos/gview_request_interceptor.h" | 11 #include "chrome/browser/chromeos/gview_request_interceptor.h" |
| 11 #include "chrome/browser/plugin_prefs.h" | 12 #include "chrome/browser/plugin_prefs.h" |
| 12 #include "chrome/browser/plugin_prefs_factory.h" | 13 #include "chrome/browser/plugin_prefs_factory.h" |
| 13 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
| 14 #include "chrome/test/base/testing_pref_service.h" | 15 #include "chrome/test/base/testing_pref_service.h" |
| 15 #include "content/browser/mock_resource_context.h" | 16 #include "content/browser/mock_resource_context.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 plugin_prefs_ = new PluginPrefs(); | 94 plugin_prefs_ = new PluginPrefs(); |
| 94 plugin_prefs_->SetPrefs(&prefs_); | 95 plugin_prefs_->SetPrefs(&prefs_); |
| 95 ChromePluginServiceFilter* filter = | 96 ChromePluginServiceFilter* filter = |
| 96 ChromePluginServiceFilter::GetInstance(); | 97 ChromePluginServiceFilter::GetInstance(); |
| 97 filter->RegisterResourceContext(plugin_prefs_, resource_context); | 98 filter->RegisterResourceContext(plugin_prefs_, resource_context); |
| 98 PluginService::GetInstance()->set_filter(filter); | 99 PluginService::GetInstance()->set_filter(filter); |
| 99 | 100 |
| 100 ASSERT_TRUE(PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path_)); | 101 ASSERT_TRUE(PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_path_)); |
| 101 | 102 |
| 102 handler_ = new content::DummyResourceHandler(); | 103 handler_ = new content::DummyResourceHandler(); |
| 104 |
| 105 PluginService::GetInstance()->RefreshPluginList(); |
| 106 PluginService::GetInstance()->GetPlugins(base::Bind(&QuitMessageLoop)); |
| 107 MessageLoop::current()->Run(); |
| 103 } | 108 } |
| 104 | 109 |
| 105 virtual void TearDown() { | 110 virtual void TearDown() { |
| 106 plugin_prefs_->ShutdownOnUIThread(); | 111 plugin_prefs_->ShutdownOnUIThread(); |
| 107 content::ResourceContext* resource_context = | 112 content::ResourceContext* resource_context = |
| 108 content::MockResourceContext::GetInstance(); | 113 content::MockResourceContext::GetInstance(); |
| 109 net::URLRequestContext* request_context = | 114 net::URLRequestContext* request_context = |
| 110 resource_context->request_context(); | 115 resource_context->request_context(); |
| 111 request_context->set_job_factory(old_factory_); | 116 request_context->set_job_factory(old_factory_); |
| 112 ChromePluginServiceFilter* filter = | 117 ChromePluginServiceFilter* filter = |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 request.Start(); | 260 request.Start(); |
| 256 MessageLoop::current()->Run(); | 261 MessageLoop::current()->Run(); |
| 257 EXPECT_EQ(1, test_delegate_.received_redirect_count()); | 262 EXPECT_EQ(1, test_delegate_.received_redirect_count()); |
| 258 EXPECT_EQ(GURL("http://docs.google.com/gview?url=http%3A//foo.com/file.ppt"), | 263 EXPECT_EQ(GURL("http://docs.google.com/gview?url=http%3A//foo.com/file.ppt"), |
| 259 request.url()); | 264 request.url()); |
| 260 } | 265 } |
| 261 | 266 |
| 262 } // namespace | 267 } // namespace |
| 263 | 268 |
| 264 } // namespace chromeos | 269 } // namespace chromeos |
| OLD | NEW |