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

Side by Side Diff: chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc

Issue 503033002: Move ExtensionWarningService and ExtensionsWarningSet to extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@3_web_view_internal
Patch Set: rebase Created 6 years, 3 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 // Disable everything on windows only. http://crbug.com/306144 5 // Disable everything on windows only. http://crbug.com/306144
6 #ifndef OS_WIN 6 #ifndef OS_WIN
7 7
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 4078 matching lines...) Expand 10 before | Expand all | Expand 10 after
4089 #include "content/public/browser/download_interrupt_reason_values.h" 4089 #include "content/public/browser/download_interrupt_reason_values.h"
4090 #undef INTERRUPT_REASON 4090 #undef INTERRUPT_REASON
4091 } 4091 }
4092 4092
4093 TEST(ExtensionDetermineDownloadFilenameInternal, 4093 TEST(ExtensionDetermineDownloadFilenameInternal,
4094 ExtensionDetermineDownloadFilenameInternal) { 4094 ExtensionDetermineDownloadFilenameInternal) {
4095 std::string winner_id; 4095 std::string winner_id;
4096 base::FilePath filename; 4096 base::FilePath filename;
4097 downloads::FilenameConflictAction conflict_action = 4097 downloads::FilenameConflictAction conflict_action =
4098 downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY; 4098 downloads::FILENAME_CONFLICT_ACTION_UNIQUIFY;
4099 ExtensionWarningSet warnings; 4099 WarningSet warnings;
4100 4100
4101 // Empty incumbent determiner 4101 // Empty incumbent determiner
4102 warnings.clear(); 4102 warnings.clear();
4103 ExtensionDownloadsEventRouter::DetermineFilenameInternal( 4103 ExtensionDownloadsEventRouter::DetermineFilenameInternal(
4104 base::FilePath(FILE_PATH_LITERAL("a")), 4104 base::FilePath(FILE_PATH_LITERAL("a")),
4105 downloads::FILENAME_CONFLICT_ACTION_OVERWRITE, 4105 downloads::FILENAME_CONFLICT_ACTION_OVERWRITE,
4106 "suggester", 4106 "suggester",
4107 base::Time::Now(), 4107 base::Time::Now(),
4108 "", 4108 "",
4109 base::Time(), 4109 base::Time(),
(...skipping 16 matching lines...) Expand all
4126 "incumbent", 4126 "incumbent",
4127 base::Time::Now(), 4127 base::Time::Now(),
4128 &winner_id, 4128 &winner_id,
4129 &filename, 4129 &filename,
4130 &conflict_action, 4130 &conflict_action,
4131 &warnings); 4131 &warnings);
4132 EXPECT_EQ("incumbent", winner_id); 4132 EXPECT_EQ("incumbent", winner_id);
4133 EXPECT_EQ(FILE_PATH_LITERAL("a"), filename.value()); 4133 EXPECT_EQ(FILE_PATH_LITERAL("a"), filename.value());
4134 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_OVERWRITE, conflict_action); 4134 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_OVERWRITE, conflict_action);
4135 EXPECT_FALSE(warnings.empty()); 4135 EXPECT_FALSE(warnings.empty());
4136 EXPECT_EQ(ExtensionWarning::kDownloadFilenameConflict, 4136 EXPECT_EQ(Warning::kDownloadFilenameConflict,
4137 warnings.begin()->warning_type()); 4137 warnings.begin()->warning_type());
4138 EXPECT_EQ("suggester", warnings.begin()->extension_id()); 4138 EXPECT_EQ("suggester", warnings.begin()->extension_id());
4139 4139
4140 // Suggester wins 4140 // Suggester wins
4141 warnings.clear(); 4141 warnings.clear();
4142 ExtensionDownloadsEventRouter::DetermineFilenameInternal( 4142 ExtensionDownloadsEventRouter::DetermineFilenameInternal(
4143 base::FilePath(FILE_PATH_LITERAL("b")), 4143 base::FilePath(FILE_PATH_LITERAL("b")),
4144 downloads::FILENAME_CONFLICT_ACTION_PROMPT, 4144 downloads::FILENAME_CONFLICT_ACTION_PROMPT,
4145 "suggester", 4145 "suggester",
4146 base::Time::Now(), 4146 base::Time::Now(),
4147 "incumbent", 4147 "incumbent",
4148 base::Time::Now() - base::TimeDelta::FromDays(1), 4148 base::Time::Now() - base::TimeDelta::FromDays(1),
4149 &winner_id, 4149 &winner_id,
4150 &filename, 4150 &filename,
4151 &conflict_action, 4151 &conflict_action,
4152 &warnings); 4152 &warnings);
4153 EXPECT_EQ("suggester", winner_id); 4153 EXPECT_EQ("suggester", winner_id);
4154 EXPECT_EQ(FILE_PATH_LITERAL("b"), filename.value()); 4154 EXPECT_EQ(FILE_PATH_LITERAL("b"), filename.value());
4155 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); 4155 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action);
4156 EXPECT_FALSE(warnings.empty()); 4156 EXPECT_FALSE(warnings.empty());
4157 EXPECT_EQ(ExtensionWarning::kDownloadFilenameConflict, 4157 EXPECT_EQ(Warning::kDownloadFilenameConflict,
4158 warnings.begin()->warning_type()); 4158 warnings.begin()->warning_type());
4159 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); 4159 EXPECT_EQ("incumbent", warnings.begin()->extension_id());
4160 } 4160 }
4161 4161
4162 } // namespace extensions 4162 } // namespace extensions
4163 4163
4164 #endif // http://crbug.com/3061144 4164 #endif // http://crbug.com/3061144
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698