Commit e1bc798b authored by dcheng's avatar dcheng Committed by Commit bot

Standardize usage of virtual/override/final specifiers.

The Google C++ style guide states:

  Explicitly annotate overrides of virtual functions or virtual
  destructors with an override or (less frequently) final specifier.
  Older (pre-C++11) code will use the virtual keyword as an inferior
  alternative annotation. For clarity, use exactly one of override,
  final, or virtual when declaring an override.

To better conform to these guidelines, the following constructs have
been rewritten:

- if a base class has a virtual destructor, then:
    virtual ~Foo();                   ->  ~Foo() override;
- virtual void Foo() override;        ->  void Foo() override;
- virtual void Foo() override final;  ->  void Foo() final;

This patch was automatically generated. The clang plugin can generate
fixit hints, which are suggested edits when it is 100% sure it knows how
to fix a problem. The hints from the clang plugin were applied to the
source tree using the tool in https://codereview.chromium.org/598073004.

BUG=417463
R=jhawkins@chromium.org

Review URL: https://codereview.chromium.org/684613002

Cr-Commit-Position: refs/heads/master@{#301990}
parent 750ade3f
......@@ -292,7 +292,7 @@ class AboutFlagsTest : public ::testing::Test {
testing::ClearState();
}
virtual void SetUp() override {
void SetUp() override {
for (size_t i = 0; i < arraysize(kExperiments); ++i)
kExperiments[i].supported_platforms = GetCurrentPlatform();
......@@ -304,9 +304,7 @@ class AboutFlagsTest : public ::testing::Test {
testing::SetExperiments(kExperiments, arraysize(kExperiments));
}
virtual void TearDown() override {
testing::SetExperiments(NULL, 0);
}
void TearDown() override { testing::SetExperiments(NULL, 0); }
TestingPrefServiceSimple prefs_;
PrefServiceFlagsStorage flags_storage_;
......
......@@ -30,7 +30,7 @@ class CustomLauncherPageBrowserTest
public:
CustomLauncherPageBrowserTest() {}
virtual void SetUpCommandLine(base::CommandLine* command_line) override {
void SetUpCommandLine(base::CommandLine* command_line) override {
PlatformAppBrowserTest::SetUpCommandLine(command_line);
// Custom launcher pages only work in the experimental app list.
......@@ -43,8 +43,7 @@ class CustomLauncherPageBrowserTest
// Open the launcher. Ignores the Extension argument (this will simply
// activate any loaded launcher pages).
virtual void LaunchPlatformApp(
const extensions::Extension* /*unused*/) override {
void LaunchPlatformApp(const extensions::Extension* /*unused*/) override {
AppListService* service =
AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE);
DCHECK(service);
......
......@@ -39,7 +39,7 @@ const char kAppUrl[] = "http://foobar.com/drive_app";
class DriveAppConverterTest : public ExtensionBrowserTest {
public:
DriveAppConverterTest() {}
virtual ~DriveAppConverterTest() {}
~DriveAppConverterTest() override {}
// ExtensionBrowserTest:
void SetUpOnMainThread() override {
......
......@@ -12,10 +12,10 @@
class DriveAppMappingTest : public testing::Test {
public:
DriveAppMappingTest() {}
virtual ~DriveAppMappingTest() {}
~DriveAppMappingTest() override {}
// testing::Test:
virtual void SetUp() override {
void SetUp() override {
pref_service_.reset(new TestingPrefServiceSyncable);
DriveAppMapping::RegisterProfilePrefs(pref_service_->registry());
......
......@@ -91,7 +91,7 @@ class DriveAppProviderTest : public ExtensionBrowserTest,
public extensions::InstallObserver {
public:
DriveAppProviderTest() {}
virtual ~DriveAppProviderTest() {}
~DriveAppProviderTest() override {}
// ExtensionBrowserTest:
void SetUpOnMainThread() override {
......
......@@ -25,7 +25,7 @@ class EphemeralAppTestBase : public extensions::PlatformAppBrowserTest {
static const char kFileSystemTestApp[];
EphemeralAppTestBase();
virtual ~EphemeralAppTestBase();
~EphemeralAppTestBase() override;
void SetUpCommandLine(base::CommandLine* command_line) override;
void SetUpOnMainThread() override;
......
......@@ -37,7 +37,7 @@ class EphemeralAppServiceTest : public testing::Test {
typedef EphemeralAppService::LaunchTimeAppMap LaunchTimeAppMap;
EphemeralAppServiceTest() {}
virtual ~EphemeralAppServiceTest() {}
~EphemeralAppServiceTest() override {}
void RunTest(int ephemeral_app_count,
const LaunchTimeAppMap& launch_times,
......
......@@ -9,11 +9,11 @@
class SpeechRecognitionTest : public extensions::PlatformAppBrowserTest {
public:
SpeechRecognitionTest() {}
virtual ~SpeechRecognitionTest() {}
SpeechRecognitionTest() {}
~SpeechRecognitionTest() override {}
protected:
virtual void SetUp() override {
void SetUp() override {
const testing::TestInfo* const test_info =
testing::UnitTest::GetInstance()->current_test_info();
// For SpeechRecognitionTest.SpeechFromBackgroundPage test, we need to
......
......@@ -254,7 +254,7 @@ class MockDownloadWebContentsDelegate : public content::WebContentsDelegate {
class WebViewTest : public extensions::PlatformAppBrowserTest {
protected:
virtual void SetUp() override {
void SetUp() override {
if (UsesFakeSpeech()) {
// SpeechRecognition test specific SetUp.
fake_speech_recognition_manager_.reset(
......@@ -268,7 +268,7 @@ class WebViewTest : public extensions::PlatformAppBrowserTest {
extensions::PlatformAppBrowserTest::SetUp();
}
virtual void TearDown() override {
void TearDown() override {
if (UsesFakeSpeech()) {
// SpeechRecognition test specific TearDown.
content::SpeechRecognitionManager::SetManagerForTesting(NULL);
......@@ -2264,8 +2264,8 @@ IN_PROC_BROWSER_TEST_F(WebViewPluginTest, TestLoadPluginEvent) {
class WebViewCaptureTest : public WebViewTest {
public:
WebViewCaptureTest() {}
virtual ~WebViewCaptureTest() {}
virtual void SetUp() override {
~WebViewCaptureTest() override {}
void SetUp() override {
EnablePixelOutput();
WebViewTest::SetUp();
}
......
......@@ -70,7 +70,7 @@ class BookmarkProviderTest : public testing::Test {
BookmarkProviderTest();
protected:
virtual void SetUp() override;
void SetUp() override;
bookmarks::TestBookmarkClient client_;
scoped_ptr<TestingProfile> profile_;
......
......@@ -27,10 +27,10 @@ class BuiltinProviderTest : public testing::Test {
};
BuiltinProviderTest() : provider_(NULL) {}
virtual ~BuiltinProviderTest() {}
~BuiltinProviderTest() override {}
virtual void SetUp() override { provider_ = new BuiltinProvider(); }
virtual void TearDown() override { provider_ = NULL; }
void SetUp() override { provider_ = new BuiltinProvider(); }
void TearDown() override { provider_ = NULL; }
void RunTest(const TestData cases[], size_t num_cases) {
ACMatches matches;
......
......@@ -136,8 +136,8 @@ class HistoryQuickProviderTest : public testing::Test {
NULL, NULL, base::Closure());
}
virtual void SetUp();
virtual void TearDown();
void SetUp() override;
void TearDown() override;
virtual void GetTestData(size_t* data_count, TestURLInfo** test_data);
......
......@@ -163,7 +163,7 @@ class HistoryURLProviderTest : public testing::Test,
HistoryQuickProvider::set_disabled(true);
}
virtual ~HistoryURLProviderTest() {
~HistoryURLProviderTest() override {
HistoryQuickProvider::set_disabled(false);
}
......
......@@ -62,10 +62,10 @@ void ScopedExtensionLoadObserver::OnExtensionInstalled(
class KeywordExtensionsDelegateImplTest : public ExtensionServiceTestBase {
public:
KeywordExtensionsDelegateImplTest() {}
virtual ~KeywordExtensionsDelegateImplTest() {}
~KeywordExtensionsDelegateImplTest() override {}
protected:
virtual void SetUp() override;
void SetUp() override;
void RunTest(bool incognito);
......
......@@ -157,8 +157,8 @@ class SearchProviderTest : public testing::Test,
}
// See description above class for what this registers.
virtual void SetUp() override;
virtual void TearDown() override;
void SetUp() override;
void TearDown() override;
void RunTest(TestData* cases, int num_cases, bool prefer_keyword);
......
......@@ -35,8 +35,8 @@ class ShortcutsBackendTest : public testing::Test,
AutocompleteMatch::Type type = AutocompleteMatchType::URL_WHAT_YOU_TYPED);
void SetSearchProvider();
virtual void SetUp();
virtual void TearDown();
void SetUp() override;
void TearDown() override;
void OnShortcutsLoaded() override;
void OnShortcutsChanged() override;
......
......@@ -260,8 +260,8 @@ class ShortcutsProviderTest : public testing::Test {
std::set<ExpectedURLAndAllowedToBeDefault> matches_;
};
virtual void SetUp();
virtual void TearDown();
void SetUp() override;
void TearDown() override;
// Fills test data into the provider.
void FillData(TestShortcutInfo* db, size_t db_size);
......
......@@ -99,8 +99,7 @@ class FakeEmptyTopSites : public history::TopSites {
// after top sites have been requested.
GetMostVisitedURLsCallback mv_callback;
protected:
virtual ~FakeEmptyTopSites() {
}
~FakeEmptyTopSites() override {}
};
void FakeEmptyTopSites::GetMostVisitedURLs(
......@@ -117,8 +116,8 @@ class ZeroSuggestProviderTest : public testing::Test,
public:
ZeroSuggestProviderTest();
virtual void SetUp() override;
virtual void TearDown() override;
void SetUp() override;
void TearDown() override;
protected:
// AutocompleteProviderListener:
......
......@@ -52,10 +52,10 @@ class TestPersonalDataManager : public PersonalDataManager {
class AutofillCCInfobarDelegateTest : public ChromeRenderViewHostTestHarness {
public:
virtual ~AutofillCCInfobarDelegateTest();
~AutofillCCInfobarDelegateTest() override;
virtual void SetUp() override;
virtual void TearDown() override;
void SetUp() override;
void TearDown() override;
protected:
scoped_ptr<ConfirmInfoBarDelegate> CreateDelegate(
......
......@@ -200,7 +200,7 @@ class AutofillInteractiveTest : public InProcessBrowserTest {
key_press_event_sink_(
base::Bind(&AutofillInteractiveTest::HandleKeyPressEvent,
base::Unretained(this))) {}
virtual ~AutofillInteractiveTest() {}
~AutofillInteractiveTest() override {}
// InProcessBrowserTest:
void SetUpOnMainThread() override {
......
......@@ -45,7 +45,7 @@ class FormStructureBrowserTest : public InProcessBrowserTest,
public DataDrivenTest {
protected:
FormStructureBrowserTest();
virtual ~FormStructureBrowserTest();
~FormStructureBrowserTest() override;
// DataDrivenTest:
void GenerateResults(const std::string& input, std::string* output) override;
......
......@@ -47,7 +47,7 @@ class BackgroundApplicationListModelTest
: public extensions::ExtensionServiceTestBase {
public:
BackgroundApplicationListModelTest() {}
virtual ~BackgroundApplicationListModelTest() {}
~BackgroundApplicationListModelTest() override {}
protected:
void InitializeAndLoadEmptyExtensionService() {
......
......@@ -41,8 +41,8 @@
class BackgroundContentsServiceTest : public testing::Test {
public:
BackgroundContentsServiceTest() {}
virtual ~BackgroundContentsServiceTest() {}
virtual void SetUp() {
~BackgroundContentsServiceTest() override {}
void SetUp() override {
command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM));
}
......@@ -168,10 +168,10 @@ class BackgroundContentsServiceNotificationTest
: public BrowserWithTestWindowTest {
public:
BackgroundContentsServiceNotificationTest() {}
virtual ~BackgroundContentsServiceNotificationTest() {}
~BackgroundContentsServiceNotificationTest() override {}
// Overridden from testing::Test
virtual void SetUp() {
void SetUp() override {
BrowserWithTestWindowTest::SetUp();
// In ChromeOS environment, BrowserWithTestWindowTest initializes
// MessageCenter.
......@@ -189,7 +189,7 @@ class BackgroundContentsServiceNotificationTest
message_center::MessageCenter::Get(), base::Closure()));
}
virtual void TearDown() {
void TearDown() override {
g_browser_process->notification_ui_manager()->CancelAll();
profile_manager_.reset();
#if !defined(OS_CHROMEOS)
......
......@@ -152,8 +152,8 @@ void AssertBackgroundModeSuspended(
class BackgroundModeManagerTest : public testing::Test {
public:
BackgroundModeManagerTest() {}
virtual ~BackgroundModeManagerTest() {}
virtual void SetUp() override {
~BackgroundModeManagerTest() override {}
void SetUp() override {
command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM));
profile_manager_ = CreateTestingProfileManager();
profile_ = profile_manager_->CreateTestingProfile("p1");
......@@ -201,8 +201,8 @@ class BackgroundModeManagerWithExtensionsTest
: public BackgroundModeManagerTest {
public:
BackgroundModeManagerWithExtensionsTest() {}
virtual ~BackgroundModeManagerWithExtensionsTest() {}
virtual void SetUp() override {
~BackgroundModeManagerWithExtensionsTest() override {}
void SetUp() override {
BackgroundModeManagerTest::SetUp();
// Aura clears notifications from the message center at shutdown.
message_center::MessageCenter::Initialize();
......@@ -226,7 +226,7 @@ class BackgroundModeManagerWithExtensionsTest
manager_->RegisterProfile(profile_);
}
virtual void TearDown() {
void TearDown() override {
// Clean up the status icon. If this is not done before profile deletes,
// the context menu updates will DCHECK with the now deleted profiles.
StatusIcon* status_icon = manager_->status_icon_;
......
......@@ -71,7 +71,7 @@ class BitmapFetcherTestDelegate : public BitmapFetcherDelegate {
class BitmapFetcherBrowserTest : public InProcessBrowserTest {
public:
virtual void SetUp() override {
void SetUp() override {
url_fetcher_factory_.reset(
new net::FakeURLFetcherFactory(&url_fetcher_impl_factory_));
InProcessBrowserTest::SetUp();
......
......@@ -48,7 +48,7 @@ class TestService : public BitmapFetcherService {
class BitmapFetcherServiceTest : public testing::Test,
public TestNotificationInterface {
public:
virtual void SetUp() override {
void SetUp() override {
service_.reset(new TestService(&profile_));
requestsFinished_ = 0;
imagesChanged_ = 0;
......
......@@ -48,7 +48,7 @@ void MakeTestSkBitmap(int w, int h, SkBitmap* bmp) {
class BookmarkHTMLWriterTest : public testing::Test {
protected:
virtual void SetUp() {
void SetUp() override {
testing::Test::SetUp();
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
path_ = temp_dir_.path().AppendASCII("bookmarks.html");
......
......@@ -30,9 +30,9 @@ using testing::_;
class ChromeBookmarkClientTest : public testing::Test {
public:
ChromeBookmarkClientTest() : client_(NULL), model_(NULL) {}
virtual ~ChromeBookmarkClientTest() {}
~ChromeBookmarkClientTest() override {}
virtual void SetUp() override {
void SetUp() override {
prefs_ = profile_.GetTestingPrefService();
ASSERT_FALSE(prefs_->HasPrefPath(bookmarks::prefs::kManagedBookmarks));
......@@ -46,9 +46,7 @@ class ChromeBookmarkClientTest : public testing::Test {
EXPECT_NE(-1, model_->root_node()->GetIndexOf(client_->managed_node()));
}
virtual void TearDown() override {
model_->RemoveObserver(&observer_);
}
void TearDown() override { model_->RemoveObserver(&observer_); }
void ResetModel() {
profile_.CreateBookmarkModel(false);
......
......@@ -120,7 +120,7 @@ class BrowserProcessImpl : public BrowserProcess,
override;
#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS)
virtual void StartAutoupdateTimer() override;
void StartAutoupdateTimer() override;
#endif
ChromeNetLog* net_log() override;
......
......@@ -23,13 +23,13 @@ class BrowsingDataChannelIDHelperTest
BrowsingDataChannelIDHelperTest() : ssl_config_changed_count_(0) {
}
virtual void SetUp() override {
void SetUp() override {
testing_profile_.reset(new TestingProfile());
testing_profile_->GetSSLConfigService()->AddObserver(this);
}
virtual void TearDown() override {
void TearDown() override {
testing_profile_->GetSSLConfigService()->RemoveObserver(this);
}
......
......@@ -64,7 +64,7 @@ class BrowsingDataCookieHelperTest : public testing::Test {
: testing_profile_(new TestingProfile()) {
}
virtual void SetUp() override { cookie_expectations_.clear(); }
void SetUp() override { cookie_expectations_.clear(); }
// Adds an expectation for a cookie that satisfies the given parameters.
void AddCookieExpectation(const char* source,
......
......@@ -70,7 +70,7 @@ class BrowsingDataFileSystemHelperTest : public testing::Test {
base::MessageLoop::current()->RunUntilIdle();
canned_helper_ = new CannedBrowsingDataFileSystemHelper(profile_.get());
}
virtual ~BrowsingDataFileSystemHelperTest() {
~BrowsingDataFileSystemHelperTest() override {
// Avoid memory leaks.
profile_.reset();
base::MessageLoop::current()->RunUntilIdle();
......
......@@ -36,7 +36,7 @@ const int kUnprotected = BrowsingDataHelper::UNPROTECTED_WEB;
class BrowsingDataHelperTest : public testing::Test {
public:
BrowsingDataHelperTest() {}
virtual ~BrowsingDataHelperTest() {}
~BrowsingDataHelperTest() override {}
bool IsWebScheme(const std::string& scheme) {
GURL test(scheme + "://example.com");
......
......@@ -16,7 +16,7 @@ namespace {
class CannedBrowsingDataIndexedDBHelperTest : public testing::Test {
public:
virtual void SetUp() override {
void SetUp() override {
IndexedDBContext()->SetTaskRunnerForTesting(
base::MessageLoopProxy::current().get());
}
......
......@@ -30,9 +30,9 @@ class BrowsingDataQuotaHelperTest : public testing::Test {
quota_(-1),
weak_factory_(this) {}
virtual ~BrowsingDataQuotaHelperTest() {}
~BrowsingDataQuotaHelperTest() override {}
virtual void SetUp() override {
void SetUp() override {
EXPECT_TRUE(dir_.CreateUniqueTempDir());
quota_manager_ = new storage::QuotaManager(
false,
......@@ -46,7 +46,7 @@ class BrowsingDataQuotaHelperTest : public testing::Test {
quota_manager_.get());
}
virtual void TearDown() override {
void TearDown() override {
helper_ = NULL;
quota_manager_ = NULL;
quota_info_.clear();
......
......@@ -703,10 +703,9 @@ class BrowsingDataRemoverTest : public testing::Test,
content::Source<Profile>(profile_.get()));
}
virtual ~BrowsingDataRemoverTest() {
}
~BrowsingDataRemoverTest() override {}
virtual void TearDown() {
void TearDown() override {
#if defined(ENABLE_EXTENSIONS)
mock_policy_ = NULL;
#endif
......
......@@ -42,7 +42,7 @@ namespace {
class CookiesTreeModelTest : public testing::Test {
public:
virtual ~CookiesTreeModelTest() {
~CookiesTreeModelTest() override {
// Avoid memory leaks.