| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #undef LOG | 9 #undef LOG |
| 10 | 10 |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "net/url_request/url_request_unittest.h" | 12 #include "net/url_request/url_request_unittest.h" |
| 13 #include "webkit/glue/unittest_test_server.h" | 13 #include "webkit/glue/unittest_test_server.h" |
| 14 #include "webkit/glue/webkit_glue.h" | 14 #include "webkit/glue/webkit_glue.h" |
| 15 #include "webkit/glue/webview.h" | 15 #include "webkit/glue/webview.h" |
| 16 #include "webkit/tools/test_shell/test_shell_test.h" | 16 #include "webkit/tools/test_shell/test_shell_test.h" |
| 17 | 17 |
| 18 using WebKit::WebFrame; | 18 using WebKit::WebFrame; |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 class MimeTypeTests : public TestShellTest { | 22 class MimeTypeTests : public TestShellTest { |
| 23 public: | 23 public: |
| 24 void LoadURL(const GURL& url) { | 24 void LoadURL(const GURL& url) { |
| 25 test_shell_->LoadURL(UTF8ToWide(url.spec()).c_str()); | 25 test_shell_->LoadURL(url); |
| 26 test_shell_->WaitTestFinished(); | 26 test_shell_->WaitTestFinished(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 void CheckMimeType(const char* mimetype, const std::wstring& expected) { | 29 void CheckMimeType(const char* mimetype, const std::wstring& expected) { |
| 30 std::string path("contenttype?"); | 30 std::string path("contenttype?"); |
| 31 GURL url = server_->TestServerPage(path + mimetype); | 31 GURL url = server_->TestServerPage(path + mimetype); |
| 32 LoadURL(url); | 32 LoadURL(url); |
| 33 WebFrame* frame = test_shell_->webView()->GetMainFrame(); | 33 WebFrame* frame = test_shell_->webView()->GetMainFrame(); |
| 34 EXPECT_EQ(expected, webkit_glue::DumpDocumentText(frame)); | 34 EXPECT_EQ(expected, webkit_glue::DumpDocumentText(frame)); |
| 35 } | 35 } |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 CheckMimeType(not_text[i], L""); | 85 CheckMimeType(not_text[i], L""); |
| 86 test_shell_->webView()->StopLoading(); | 86 test_shell_->webView()->StopLoading(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // TODO(tc): make sure other mime types properly go to download (e.g., | 89 // TODO(tc): make sure other mime types properly go to download (e.g., |
| 90 // image/foo). | 90 // image/foo). |
| 91 | 91 |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace | 94 } // namespace |
| OLD | NEW |