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

Side by Side Diff: chrome/test/ppapi/ppapi_filechooser_browsertest.cc

Issue 2127373006: Use base::StartWith() in more places when appropriate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, resolve conflict Created 4 years, 5 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <map> 5 #include <map>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
11 #include "base/strings/string_util.h"
11 #include "base/threading/thread_task_runner_handle.h" 12 #include "base/threading/thread_task_runner_handle.h"
12 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
13 #include "chrome/test/ppapi/ppapi_test.h" 14 #include "chrome/test/ppapi/ppapi_test.h"
14 #include "ppapi/shared_impl/test_utils.h" 15 #include "ppapi/shared_impl/test_utils.h"
15 #include "ui/shell_dialogs/select_file_dialog.h" 16 #include "ui/shell_dialogs/select_file_dialog.h"
16 #include "ui/shell_dialogs/select_file_dialog_factory.h" 17 #include "ui/shell_dialogs/select_file_dialog_factory.h"
17 #include "ui/shell_dialogs/selected_file_info.h" 18 #include "ui/shell_dialogs/selected_file_info.h"
18 19
19 #if defined(FULL_SAFE_BROWSING) 20 #if defined(FULL_SAFE_BROWSING)
20 #include "chrome/browser/safe_browsing/download_protection_service.h" 21 #include "chrome/browser/safe_browsing/download_protection_service.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 DownloadProtectionService::SAFE; 141 DownloadProtectionService::SAFE;
141 }; 142 };
142 143
143 class FakeDatabaseManager 144 class FakeDatabaseManager
144 : public safe_browsing::TestSafeBrowsingDatabaseManager { 145 : public safe_browsing::TestSafeBrowsingDatabaseManager {
145 public: 146 public:
146 bool IsSupported() const override { return true; } 147 bool IsSupported() const override { return true; }
147 bool MatchDownloadWhitelistUrl(const GURL& url) override { 148 bool MatchDownloadWhitelistUrl(const GURL& url) override {
148 // This matches the behavior in RunTestViaHTTP(). 149 // This matches the behavior in RunTestViaHTTP().
149 return url.SchemeIsHTTPOrHTTPS() && url.has_path() && 150 return url.SchemeIsHTTPOrHTTPS() && url.has_path() &&
150 url.path().find("/test_case.html") == 0; 151 base::StartsWith(url.path(), "/test_case.html",
152 base::CompareCase::SENSITIVE);
151 } 153 }
152 154
153 protected: 155 protected:
154 ~FakeDatabaseManager() override {} 156 ~FakeDatabaseManager() override {}
155 }; 157 };
156 158
157 class FakeDownloadProtectionService : public DownloadProtectionService { 159 class FakeDownloadProtectionService : public DownloadProtectionService {
158 public: 160 public:
159 explicit FakeDownloadProtectionService( 161 explicit FakeDownloadProtectionService(
160 const SafeBrowsingTestConfiguration* test_config) 162 const SafeBrowsingTestConfiguration* test_config)
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 std::make_pair(base::FilePath::StringType(FILE_PATH_LITERAL(".exe")), 405 std::make_pair(base::FilePath::StringType(FILE_PATH_LITERAL(".exe")),
404 DownloadProtectionService::DANGEROUS)); 406 DownloadProtectionService::DANGEROUS));
405 407
406 TestSelectFileDialogFactory test_dialog_factory( 408 TestSelectFileDialogFactory test_dialog_factory(
407 TestSelectFileDialogFactory::NOT_REACHED, 409 TestSelectFileDialogFactory::NOT_REACHED,
408 TestSelectFileDialogFactory::SelectedFileInfoList()); 410 TestSelectFileDialogFactory::SelectedFileInfoList());
409 RunTestViaHTTP("FileChooser_SaveAsDangerousExtensionListDisallowed"); 411 RunTestViaHTTP("FileChooser_SaveAsDangerousExtensionListDisallowed");
410 } 412 }
411 413
412 #endif // FULL_SAFE_BROWSING 414 #endif // FULL_SAFE_BROWSING
OLDNEW
« no previous file with comments | « chrome/test/chromedriver/chrome/devtools_http_client.cc ('k') | chrome/utility/media_galleries/picasa_albums_indexer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698