Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: chrome/browser/ui/webui/fileicon_source_unittest.cc

Issue 11885021: Don't derive from ChromeURLDataManager::DataSource, and instead have these classes implement a dele… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: nits Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/public/test/test_browser_thread.h" 11 #include "content/public/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_METHOD4(FetchFileIcon, void(const FilePath& path, 23 MOCK_METHOD4(FetchFileIcon, void(const FilePath& path,
24 ui::ScaleFactor scale_factor, 24 ui::ScaleFactor scale_factor,
25 IconLoader::IconSize icon_size, 25 IconLoader::IconSize icon_size,
26 int request_id)); 26 int request_id));
27 27
28 private:
29 virtual ~TestFileIconSource() {} 28 virtual ~TestFileIconSource() {}
30 }; 29 };
31 30
32 class FileIconSourceTest : public testing::Test { 31 class FileIconSourceTest : public testing::Test {
33 public: 32 public:
34 FileIconSourceTest() 33 FileIconSourceTest()
35 : loop_(MessageLoop::TYPE_UI), 34 : loop_(MessageLoop::TYPE_UI),
36 ui_thread_(BrowserThread::UI, MessageLoop::current()), 35 ui_thread_(BrowserThread::UI, MessageLoop::current()),
37 file_thread_(BrowserThread::FILE, MessageLoop::current()) {} 36 file_thread_(BrowserThread::FILE, MessageLoop::current()) {}
38 37
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 IconLoader::NORMAL }, 106 IconLoader::NORMAL },
108 { "%2Fbaz%20(1).txt?iconsize=small", FILE_PATH_LITERAL("/baz (1).txt"), 107 { "%2Fbaz%20(1).txt?iconsize=small", FILE_PATH_LITERAL("/baz (1).txt"),
109 ui::SCALE_FACTOR_100P, IconLoader::SMALL }, 108 ui::SCALE_FACTOR_100P, IconLoader::SMALL },
110 #endif 109 #endif
111 }; 110 };
112 111
113 } // namespace 112 } // namespace
114 113
115 TEST_F(FileIconSourceTest, FileIconSource_Parse) { 114 TEST_F(FileIconSourceTest, FileIconSource_Parse) {
116 for (unsigned i = 0; i < arraysize(kBasicExpectations); i++) { 115 for (unsigned i = 0; i < arraysize(kBasicExpectations); i++) {
117 scoped_refptr<TestFileIconSource> source(CreateFileIconSource()); 116 scoped_ptr<TestFileIconSource> source(CreateFileIconSource());
118 EXPECT_CALL(*source.get(), 117 EXPECT_CALL(*source.get(),
119 FetchFileIcon(FilePath(kBasicExpectations[i].unescaped_path), 118 FetchFileIcon(FilePath(kBasicExpectations[i].unescaped_path),
120 kBasicExpectations[i].scale_factor, 119 kBasicExpectations[i].scale_factor,
121 kBasicExpectations[i].size, i)); 120 kBasicExpectations[i].size, i));
122 source->StartDataRequest(kBasicExpectations[i].request_path, false, i); 121 source->StartDataRequest(kBasicExpectations[i].request_path, false, i);
123 } 122 }
124 } 123 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698