| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/memory/ref_counted_memory.h" | 8 #include "base/memory/ref_counted_memory.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 void SendResponse(scoped_refptr<base::RefCountedMemory> data) { | 49 void SendResponse(scoped_refptr<base::RefCountedMemory> data) { |
| 50 result_data_size_ = data ? data->size() : 0; | 50 result_data_size_ = data ? data->size() : 0; |
| 51 } | 51 } |
| 52 | 52 |
| 53 content::URLDataSource::GotDataCallback callback_; | 53 content::URLDataSource::GotDataCallback callback_; |
| 54 | 54 |
| 55 base::MessageLoop loop_; | 55 base::MessageLoop loop_; |
| 56 content::TestBrowserThread ui_thread_; | 56 content::TestBrowserThread ui_thread_; |
| 57 | 57 |
| 58 scoped_ptr<TestingProfile> profile_; | 58 std::unique_ptr<TestingProfile> profile_; |
| 59 scoped_ptr<ThemeSource> theme_source_; | 59 std::unique_ptr<ThemeSource> theme_source_; |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 TEST_F(WebUISourcesTest, ThemeSourceMimeTypes) { | 62 TEST_F(WebUISourcesTest, ThemeSourceMimeTypes) { |
| 63 EXPECT_EQ(theme_source()->GetMimeType("css/new_tab_theme.css"), "text/css"); | 63 EXPECT_EQ(theme_source()->GetMimeType("css/new_tab_theme.css"), "text/css"); |
| 64 EXPECT_EQ(theme_source()->GetMimeType("css/new_tab_theme.css?foo"), | 64 EXPECT_EQ(theme_source()->GetMimeType("css/new_tab_theme.css?foo"), |
| 65 "text/css"); | 65 "text/css"); |
| 66 EXPECT_EQ(theme_source()->GetMimeType("WRONGURL"), "image/png"); | 66 EXPECT_EQ(theme_source()->GetMimeType("WRONGURL"), "image/png"); |
| 67 } | 67 } |
| 68 | 68 |
| 69 TEST_F(WebUISourcesTest, ThemeSourceImages) { | 69 TEST_F(WebUISourcesTest, ThemeSourceImages) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 91 | 91 |
| 92 StartDataRequest("css/new_tab_theme.css?pie"); | 92 StartDataRequest("css/new_tab_theme.css?pie"); |
| 93 EXPECT_NE(result_data_size_, empty_size); | 93 EXPECT_NE(result_data_size_, empty_size); |
| 94 | 94 |
| 95 #if !DCHECK_IS_ON() | 95 #if !DCHECK_IS_ON() |
| 96 // Check that we send NULL back when we can't find what we're looking for. | 96 // Check that we send NULL back when we can't find what we're looking for. |
| 97 StartDataRequest("css/WRONGURL"); | 97 StartDataRequest("css/WRONGURL"); |
| 98 EXPECT_EQ(result_data_size_, empty_size); | 98 EXPECT_EQ(result_data_size_, empty_size); |
| 99 #endif | 99 #endif |
| 100 } | 100 } |
| OLD | NEW |