| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/memory/ref_counted_memory.h" | 6 #include "base/memory/ref_counted_memory.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "content/browser/webui/web_ui_data_source_impl.h" | 8 #include "content/browser/webui/web_ui_data_source_impl.h" |
| 9 #include "content/test/test_content_client.h" | 9 #include "content/test/test_content_client.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 | 52 |
| 53 class WebUIDataSourceTest : public testing::Test { | 53 class WebUIDataSourceTest : public testing::Test { |
| 54 public: | 54 public: |
| 55 WebUIDataSourceTest() : result_data_(NULL) {} | 55 WebUIDataSourceTest() : result_data_(NULL) {} |
| 56 virtual ~WebUIDataSourceTest() {} | 56 virtual ~WebUIDataSourceTest() {} |
| 57 WebUIDataSourceImpl* source() { return source_.get(); } | 57 WebUIDataSourceImpl* source() { return source_.get(); } |
| 58 | 58 |
| 59 void StartDataRequest(const std::string& path) { | 59 void StartDataRequest(const std::string& path) { |
| 60 source_->StartDataRequest( | 60 source_->StartDataRequest( |
| 61 path, | 61 path, |
| 62 false, | 62 0, 0, |
| 63 base::Bind(&WebUIDataSourceTest::SendResult, | 63 base::Bind(&WebUIDataSourceTest::SendResult, |
| 64 base::Unretained(this))); | 64 base::Unretained(this))); |
| 65 } | 65 } |
| 66 | 66 |
| 67 std::string GetMimeType(const std::string& path) const { | 67 std::string GetMimeType(const std::string& path) const { |
| 68 return source_->GetMimeType(path); | 68 return source_->GetMimeType(path); |
| 69 } | 69 } |
| 70 | 70 |
| 71 scoped_refptr<base::RefCountedMemory> result_data_; | 71 scoped_refptr<base::RefCountedMemory> result_data_; |
| 72 | 72 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 EXPECT_EQ(GetMimeType("foo"), html); | 145 EXPECT_EQ(GetMimeType("foo"), html); |
| 146 EXPECT_EQ(GetMimeType("foo.html"), html); | 146 EXPECT_EQ(GetMimeType("foo.html"), html); |
| 147 EXPECT_EQ(GetMimeType(".js"), js); | 147 EXPECT_EQ(GetMimeType(".js"), js); |
| 148 EXPECT_EQ(GetMimeType("foo.js"), js); | 148 EXPECT_EQ(GetMimeType("foo.js"), js); |
| 149 EXPECT_EQ(GetMimeType("js"), html); | 149 EXPECT_EQ(GetMimeType("js"), html); |
| 150 EXPECT_EQ(GetMimeType("foojs"), html); | 150 EXPECT_EQ(GetMimeType("foojs"), html); |
| 151 EXPECT_EQ(GetMimeType("foo.jsp"), html); | 151 EXPECT_EQ(GetMimeType("foo.jsp"), html); |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace content | 154 } // namespace content |
| OLD | NEW |