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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/file_browser_handler_api_test.cc

Issue 623293003: replace OVERRIDE and FINAL with override and final in chrome/browser/chromeos/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: run git cl format on echo_dialog_view.h Created 6 years, 2 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
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 // File contains browser tests for the fileBrowserHandler api. 5 // File contains browser tests for the fileBrowserHandler api.
6 6
7 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_handler_a pi.h" 7 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_handler_a pi.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 selected_path_(selected_path) { 80 selected_path_(selected_path) {
81 } 81 }
82 virtual ~MockFileSelector() {} 82 virtual ~MockFileSelector() {}
83 83
84 // file_manager::FileSelector implementation. 84 // file_manager::FileSelector implementation.
85 // |browser| is not used. 85 // |browser| is not used.
86 virtual void SelectFile( 86 virtual void SelectFile(
87 const base::FilePath& suggested_name, 87 const base::FilePath& suggested_name,
88 const std::vector<std::string>& allowed_extensions, 88 const std::vector<std::string>& allowed_extensions,
89 Browser* browser, 89 Browser* browser,
90 FileBrowserHandlerInternalSelectFileFunction* function) OVERRIDE { 90 FileBrowserHandlerInternalSelectFileFunction* function) override {
91 // Confirm that the function suggested us the right name. 91 // Confirm that the function suggested us the right name.
92 EXPECT_EQ(suggested_name_, suggested_name); 92 EXPECT_EQ(suggested_name_, suggested_name);
93 // Confirm that the function allowed us the right extensions. 93 // Confirm that the function allowed us the right extensions.
94 EXPECT_EQ(allowed_extensions_.size(), allowed_extensions.size()); 94 EXPECT_EQ(allowed_extensions_.size(), allowed_extensions.size());
95 if (allowed_extensions_.size() == allowed_extensions.size()) { 95 if (allowed_extensions_.size() == allowed_extensions.size()) {
96 for (size_t i = 0; i < allowed_extensions_.size(); ++i) { 96 for (size_t i = 0; i < allowed_extensions_.size(); ++i) {
97 EXPECT_EQ(allowed_extensions_[i], allowed_extensions[i]); 97 EXPECT_EQ(allowed_extensions_[i], allowed_extensions[i]);
98 } 98 }
99 } 99 }
100 100
(...skipping 28 matching lines...) Expand all
129 public: 129 public:
130 explicit MockFileSelectorFactory(const TestCase& test_case) 130 explicit MockFileSelectorFactory(const TestCase& test_case)
131 : suggested_name_(test_case.suggested_name), 131 : suggested_name_(test_case.suggested_name),
132 allowed_extensions_(test_case.allowed_extensions), 132 allowed_extensions_(test_case.allowed_extensions),
133 success_(test_case.success), 133 success_(test_case.success),
134 selected_path_(test_case.selected_path) { 134 selected_path_(test_case.selected_path) {
135 } 135 }
136 virtual ~MockFileSelectorFactory() {} 136 virtual ~MockFileSelectorFactory() {}
137 137
138 // file_manager::FileSelectorFactory implementation. 138 // file_manager::FileSelectorFactory implementation.
139 virtual file_manager::FileSelector* CreateFileSelector() const OVERRIDE { 139 virtual file_manager::FileSelector* CreateFileSelector() const override {
140 return new MockFileSelector(suggested_name_, 140 return new MockFileSelector(suggested_name_,
141 allowed_extensions_, 141 allowed_extensions_,
142 success_, 142 success_,
143 selected_path_); 143 selected_path_);
144 } 144 }
145 145
146 private: 146 private:
147 // File name that is expected to be suggested by the function. 147 // File name that is expected to be suggested by the function.
148 base::FilePath suggested_name_; 148 base::FilePath suggested_name_;
149 // Extensions that is expected to be allowed by the function. 149 // Extensions that is expected to be allowed by the function.
150 std::vector<std::string> allowed_extensions_; 150 std::vector<std::string> allowed_extensions_;
151 // Whether the selection should succeed. 151 // Whether the selection should succeed.
152 bool success_; 152 bool success_;
153 // File path that should be returned to the function. 153 // File path that should be returned to the function.
154 base::FilePath selected_path_; 154 base::FilePath selected_path_;
155 155
156 DISALLOW_COPY_AND_ASSIGN(MockFileSelectorFactory); 156 DISALLOW_COPY_AND_ASSIGN(MockFileSelectorFactory);
157 }; 157 };
158 158
159 // Extension api test for the fileBrowserHandler extension API. 159 // Extension api test for the fileBrowserHandler extension API.
160 class FileBrowserHandlerExtensionTest : public ExtensionApiTest { 160 class FileBrowserHandlerExtensionTest : public ExtensionApiTest {
161 protected: 161 protected:
162 virtual void SetUp() OVERRIDE { 162 virtual void SetUp() override {
163 // Create mount point directory that will be used in the test. 163 // Create mount point directory that will be used in the test.
164 // Mount point will be called "tmp", and it will be located in a tmp 164 // Mount point will be called "tmp", and it will be located in a tmp
165 // directory with an unique name. 165 // directory with an unique name.
166 ASSERT_TRUE(scoped_tmp_dir_.CreateUniqueTempDir()); 166 ASSERT_TRUE(scoped_tmp_dir_.CreateUniqueTempDir());
167 tmp_mount_point_ = scoped_tmp_dir_.path().Append("tmp"); 167 tmp_mount_point_ = scoped_tmp_dir_.path().Append("tmp");
168 base::CreateDirectory(tmp_mount_point_); 168 base::CreateDirectory(tmp_mount_point_);
169 169
170 ExtensionApiTest::SetUp(); 170 ExtensionApiTest::SetUp();
171 } 171 }
172 172
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 select_file_function.get(), 368 select_file_function.get(),
369 "[{\"suggestedName\": \"/path_to_file/some_file_name.txt\"}]", 369 "[{\"suggestedName\": \"/path_to_file/some_file_name.txt\"}]",
370 browser()))); 370 browser())));
371 371
372 EXPECT_FALSE(utils::GetBoolean(result.get(), "success")); 372 EXPECT_FALSE(utils::GetBoolean(result.get(), "success"));
373 base::DictionaryValue* entry_info; 373 base::DictionaryValue* entry_info;
374 EXPECT_FALSE(result->GetDictionary("entry", &entry_info)); 374 EXPECT_FALSE(result->GetDictionary("entry", &entry_info));
375 } 375 }
376 376
377 } // namespace 377 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698