| 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" |
| 11 #include "content/test/test_browser_thread.h" | 11 #include "content/test/test_browser_thread.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
| 14 | 14 |
| 15 using content::BrowserThread; | 15 using content::BrowserThread; |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 class TestFileIconSource : public FileIconSource { | 19 class TestFileIconSource : public FileIconSource { |
| 20 public: | 20 public: |
| 21 explicit TestFileIconSource() {} | 21 explicit TestFileIconSource() {} |
| 22 | 22 |
| 23 MOCK_METHOD3(FetchFileIcon, void(const FilePath& path, | 23 MOCK_METHOD3(FetchFileIcon, void(const FilePath& path, |
| 24 IconLoader::IconSize icon_size, | 24 IconLoader::IconSize icon_size, |
| 25 int request_id)); | 25 int request_id)); |
| 26 |
| 27 private: |
| 28 virtual ~TestFileIconSource() {} |
| 26 }; | 29 }; |
| 27 | 30 |
| 28 class FileIconSourceTest : public testing::Test { | 31 class FileIconSourceTest : public testing::Test { |
| 29 public: | 32 public: |
| 30 FileIconSourceTest() | 33 FileIconSourceTest() |
| 31 : loop_(MessageLoop::TYPE_UI), | 34 : loop_(MessageLoop::TYPE_UI), |
| 32 ui_thread_(BrowserThread::UI, MessageLoop::current()), | 35 ui_thread_(BrowserThread::UI, MessageLoop::current()), |
| 33 file_thread_(BrowserThread::FILE, MessageLoop::current()) {} | 36 file_thread_(BrowserThread::FILE, MessageLoop::current()) {} |
| 34 | 37 |
| 35 static TestFileIconSource* CreateFileIconSource() { | 38 static TestFileIconSource* CreateFileIconSource() { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 92 |
| 90 TEST_F(FileIconSourceTest, FileIconSource_Parse) { | 93 TEST_F(FileIconSourceTest, FileIconSource_Parse) { |
| 91 for (unsigned i = 0; i < arraysize(kBasicExpectations); i++) { | 94 for (unsigned i = 0; i < arraysize(kBasicExpectations); i++) { |
| 92 scoped_refptr<TestFileIconSource> source(CreateFileIconSource()); | 95 scoped_refptr<TestFileIconSource> source(CreateFileIconSource()); |
| 93 EXPECT_CALL(*source.get(), | 96 EXPECT_CALL(*source.get(), |
| 94 FetchFileIcon(FilePath(kBasicExpectations[i].unescaped_path), | 97 FetchFileIcon(FilePath(kBasicExpectations[i].unescaped_path), |
| 95 kBasicExpectations[i].size, i)); | 98 kBasicExpectations[i].size, i)); |
| 96 source->StartDataRequest(kBasicExpectations[i].request_path, false, i); | 99 source->StartDataRequest(kBasicExpectations[i].request_path, false, i); |
| 97 } | 100 } |
| 98 } | 101 } |
| OLD | NEW |