| 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 "net/base/load_flags.h" | 8 #include "net/base/load_flags.h" |
| 9 #include "net/url_request/url_request.h" | 9 #include "net/url_request/url_request.h" |
| 10 #include "net/url_request/url_request_job.h" | 10 #include "net/url_request/url_request_job.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 TEST_F(GViewRequestInterceptorTest, DoNotInterceptDownload) { | 78 TEST_F(GViewRequestInterceptorTest, DoNotInterceptDownload) { |
| 79 URLRequest request(GURL("http://foo.com/file.pdf"), &test_delegate_); | 79 URLRequest request(GURL("http://foo.com/file.pdf"), &test_delegate_); |
| 80 request.set_load_flags(net::LOAD_IS_DOWNLOAD); | 80 request.set_load_flags(net::LOAD_IS_DOWNLOAD); |
| 81 request.Start(); | 81 request.Start(); |
| 82 MessageLoop::current()->Run(); | 82 MessageLoop::current()->Run(); |
| 83 EXPECT_EQ(0, test_delegate_.received_redirect_count()); | 83 EXPECT_EQ(0, test_delegate_.received_redirect_count()); |
| 84 EXPECT_EQ(GURL("http://foo.com/file.pdf"), request.url()); | 84 EXPECT_EQ(GURL("http://foo.com/file.pdf"), request.url()); |
| 85 } | 85 } |
| 86 | 86 |
| 87 TEST_F(GViewRequestInterceptorTest, InterceptPdf) { | 87 TEST_F(GViewRequestInterceptorTest, FAILS_InterceptPdf) { |
| 88 URLRequest request(GURL("http://foo.com/file.pdf"), &test_delegate_); | 88 URLRequest request(GURL("http://foo.com/file.pdf"), &test_delegate_); |
| 89 request.Start(); | 89 request.Start(); |
| 90 MessageLoop::current()->Run(); | 90 MessageLoop::current()->Run(); |
| 91 EXPECT_EQ(1, test_delegate_.received_redirect_count()); | 91 EXPECT_EQ(1, test_delegate_.received_redirect_count()); |
| 92 EXPECT_EQ(GURL("http://docs.google.com/gview?url=http%3A//foo.com/file.pdf"), | 92 EXPECT_EQ(GURL("http://docs.google.com/gview?url=http%3A//foo.com/file.pdf"), |
| 93 request.url()); | 93 request.url()); |
| 94 } | 94 } |
| 95 | 95 |
| 96 TEST_F(GViewRequestInterceptorTest, InterceptPowerpoint) { | 96 TEST_F(GViewRequestInterceptorTest, InterceptPowerpoint) { |
| 97 URLRequest request(GURL("http://foo.com/file.ppt"), &test_delegate_); | 97 URLRequest request(GURL("http://foo.com/file.ppt"), &test_delegate_); |
| 98 request.Start(); | 98 request.Start(); |
| 99 MessageLoop::current()->Run(); | 99 MessageLoop::current()->Run(); |
| 100 EXPECT_EQ(1, test_delegate_.received_redirect_count()); | 100 EXPECT_EQ(1, test_delegate_.received_redirect_count()); |
| 101 EXPECT_EQ(GURL("http://docs.google.com/gview?url=http%3A//foo.com/file.ppt"), | 101 EXPECT_EQ(GURL("http://docs.google.com/gview?url=http%3A//foo.com/file.ppt"), |
| 102 request.url()); | 102 request.url()); |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace chromeos | 105 } // namespace chromeos |
| OLD | NEW |