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/memory/ref_counted_memory.h" | 5 #include "base/memory/ref_counted_memory.h" |
6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
7 #include "chrome/browser/icon_manager.h" | 7 #include "chrome/browser/icon_manager.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/webui/fileicon_source.h" | 9 #include "chrome/browser/ui/webui/fileicon_source.h" |
10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 ui::ScaleFactor scale_factor, | 25 ui::ScaleFactor scale_factor, |
26 IconLoader::IconSize icon_size, | 26 IconLoader::IconSize icon_size, |
27 const content::URLDataSource::GotDataCallback& callback)); | 27 const content::URLDataSource::GotDataCallback& callback)); |
28 | 28 |
29 virtual ~TestFileIconSource() {} | 29 virtual ~TestFileIconSource() {} |
30 }; | 30 }; |
31 | 31 |
32 class FileIconSourceTest : public testing::Test { | 32 class FileIconSourceTest : public testing::Test { |
33 public: | 33 public: |
34 FileIconSourceTest() | 34 FileIconSourceTest() |
35 : loop_(MessageLoop::TYPE_UI), | 35 : loop_(base::MessageLoop::TYPE_UI), |
36 ui_thread_(BrowserThread::UI, MessageLoop::current()), | 36 ui_thread_(BrowserThread::UI, base::MessageLoop::current()), |
37 file_thread_(BrowserThread::FILE, MessageLoop::current()) {} | 37 file_thread_(BrowserThread::FILE, base::MessageLoop::current()) {} |
38 | 38 |
39 static TestFileIconSource* CreateFileIconSource() { | 39 static TestFileIconSource* CreateFileIconSource() { |
40 return new TestFileIconSource(); | 40 return new TestFileIconSource(); |
41 } | 41 } |
42 | 42 |
43 private: | 43 private: |
44 MessageLoop loop_; | 44 base::MessageLoop loop_; |
45 content::TestBrowserThread ui_thread_; | 45 content::TestBrowserThread ui_thread_; |
46 content::TestBrowserThread file_thread_; | 46 content::TestBrowserThread file_thread_; |
47 }; | 47 }; |
48 | 48 |
49 const struct FetchFileIconExpectation { | 49 const struct FetchFileIconExpectation { |
50 const char* request_path; | 50 const char* request_path; |
51 const base::FilePath::CharType* unescaped_path; | 51 const base::FilePath::CharType* unescaped_path; |
52 ui::ScaleFactor scale_factor; | 52 ui::ScaleFactor scale_factor; |
53 IconLoader::IconSize size; | 53 IconLoader::IconSize size; |
54 } kBasicExpectations[] = { | 54 } kBasicExpectations[] = { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 content::URLDataSource::GotDataCallback callback; | 129 content::URLDataSource::GotDataCallback callback; |
130 EXPECT_CALL(*source.get(), | 130 EXPECT_CALL(*source.get(), |
131 FetchFileIcon( | 131 FetchFileIcon( |
132 base::FilePath(kBasicExpectations[i].unescaped_path), | 132 base::FilePath(kBasicExpectations[i].unescaped_path), |
133 kBasicExpectations[i].scale_factor, | 133 kBasicExpectations[i].scale_factor, |
134 kBasicExpectations[i].size, CallbackIsNull())); | 134 kBasicExpectations[i].size, CallbackIsNull())); |
135 source->StartDataRequest(kBasicExpectations[i].request_path, -1, -1, | 135 source->StartDataRequest(kBasicExpectations[i].request_path, -1, -1, |
136 callback); | 136 callback); |
137 } | 137 } |
138 } | 138 } |
OLD | NEW |