| 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/strings/utf_string_conversions.h" | 7 #include "base/strings/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 19 matching lines...) Expand all Loading... |
| 30 return base::UTF8ToUTF16(kDummyString); | 30 return base::UTF8ToUTF16(kDummyString); |
| 31 return base::string16(); | 31 return base::string16(); |
| 32 | 32 |
| 33 } | 33 } |
| 34 | 34 |
| 35 virtual base::RefCountedStaticMemory* GetDataResourceBytes( | 35 virtual base::RefCountedStaticMemory* GetDataResourceBytes( |
| 36 int resource_id) const OVERRIDE { | 36 int resource_id) const OVERRIDE { |
| 37 base::RefCountedStaticMemory* bytes = NULL; | 37 base::RefCountedStaticMemory* bytes = NULL; |
| 38 if (resource_id == kDummyDefaultResourceId) { | 38 if (resource_id == kDummyDefaultResourceId) { |
| 39 bytes = new base::RefCountedStaticMemory( | 39 bytes = new base::RefCountedStaticMemory( |
| 40 reinterpret_cast<const unsigned char*>(kDummyDefaultResource), | 40 kDummyDefaultResource, arraysize(kDummyDefaultResource)); |
| 41 arraysize(kDummyDefaultResource)); | |
| 42 } else if (resource_id == kDummyResourceId) { | 41 } else if (resource_id == kDummyResourceId) { |
| 43 bytes = new base::RefCountedStaticMemory( | 42 bytes = new base::RefCountedStaticMemory( |
| 44 reinterpret_cast<const unsigned char*>(kDummytResource), | 43 kDummytResource, arraysize(kDummytResource)); |
| 45 arraysize(kDummytResource)); | |
| 46 } | 44 } |
| 47 return bytes; | 45 return bytes; |
| 48 } | 46 } |
| 49 }; | 47 }; |
| 50 | 48 |
| 51 } | 49 } |
| 52 | 50 |
| 53 class WebUIDataSourceTest : public testing::Test { | 51 class WebUIDataSourceTest : public testing::Test { |
| 54 public: | 52 public: |
| 55 WebUIDataSourceTest() : result_data_(NULL) {} | 53 WebUIDataSourceTest() : result_data_(NULL) {} |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 EXPECT_EQ(GetMimeType("foo"), html); | 143 EXPECT_EQ(GetMimeType("foo"), html); |
| 146 EXPECT_EQ(GetMimeType("foo.html"), html); | 144 EXPECT_EQ(GetMimeType("foo.html"), html); |
| 147 EXPECT_EQ(GetMimeType(".js"), js); | 145 EXPECT_EQ(GetMimeType(".js"), js); |
| 148 EXPECT_EQ(GetMimeType("foo.js"), js); | 146 EXPECT_EQ(GetMimeType("foo.js"), js); |
| 149 EXPECT_EQ(GetMimeType("js"), html); | 147 EXPECT_EQ(GetMimeType("js"), html); |
| 150 EXPECT_EQ(GetMimeType("foojs"), html); | 148 EXPECT_EQ(GetMimeType("foojs"), html); |
| 151 EXPECT_EQ(GetMimeType("foo.jsp"), html); | 149 EXPECT_EQ(GetMimeType("foo.jsp"), html); |
| 152 } | 150 } |
| 153 | 151 |
| 154 } // namespace content | 152 } // namespace content |
| OLD | NEW |