Skip to content

Commit

Permalink
Standardize usage of virtual/override/final specifiers.
Browse files Browse the repository at this point in the history
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=caitkp@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#301931}
  • Loading branch information
zetafunction authored and Commit bot committed Oct 29, 2014
1 parent 6913b77 commit 30a1b15
Show file tree
Hide file tree
Showing 183 changed files with 434 additions and 498 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ class TestContentAutofillDriver : public ContentAutofillDriver {

class ContentAutofillDriverTest : public content::RenderViewHostTestHarness {
public:
virtual void SetUp() override {
void SetUp() override {
content::RenderViewHostTestHarness::SetUp();

test_autofill_client_.reset(new TestAutofillClient());
driver_.reset(new TestContentAutofillDriver(web_contents(),
test_autofill_client_.get()));
}

virtual void TearDown() override {
void TearDown() override {
// Reset the driver now to cause all pref observers to be removed and avoid
// crashes that otherwise occur in the destructor.
driver_.reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class RequestAutocompleteManagerTest :
public:
RequestAutocompleteManagerTest() {}

virtual void SetUp() override {
void SetUp() override {
content::RenderViewHostTestHarness::SetUp();

driver_.reset(
Expand All @@ -104,7 +104,7 @@ class RequestAutocompleteManagerTest :
new RequestAutocompleteManager(driver_.get()));
}

virtual void TearDown() override {
void TearDown() override {
// Reset the driver now to cause all pref observers to be removed and avoid
// crashes that otherwise occur in the destructor.
driver_.reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -750,16 +750,14 @@ class WalletClientTest : public testing::Test {
WalletClientTest()
: request_context_(new net::TestURLRequestContextGetter(
base::MessageLoopProxy::current())) {}
virtual ~WalletClientTest() {}
~WalletClientTest() override {}

virtual void SetUp() override {
void SetUp() override {
wallet_client_.reset(new WalletClient(
request_context_.get(), &delegate_, GURL(kMerchantUrl)));
}

virtual void TearDown() override {
wallet_client_.reset();
}
void TearDown() override { wallet_client_.reset(); }

void VerifyAndFinishRequest(net::HttpStatusCode response_code,
const std::string& request_body,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,16 +52,14 @@ class WalletSigninHelperTest : public testing::Test {
WalletSigninHelperTest()
: request_context_(new net::TestURLRequestContextGetter(
base::MessageLoopProxy::current())) {}
virtual ~WalletSigninHelperTest() {}
~WalletSigninHelperTest() override {}

virtual void SetUp() override {
void SetUp() override {
signin_helper_.reset(
new WalletSigninHelper(&mock_delegate_, request_context_.get()));
}

virtual void TearDown() override {
signin_helper_.reset();
}
void TearDown() override { signin_helper_.reset(); }

// Sets up a response for the mock URLFetcher and completes the request.
void SetUpFetcherResponseAndCompleteRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class PasswordFormBuilder {
class PasswordFormConversionUtilsTest : public content::RenderViewTest {
public:
PasswordFormConversionUtilsTest() : content::RenderViewTest() {}
virtual ~PasswordFormConversionUtilsTest() {}
~PasswordFormConversionUtilsTest() override {}

protected:
// Loads the given |html|, retrieves the sole WebFormElement from it, and then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ class AutocompleteHistoryManager : public WebDataServiceConsumer {
public:
AutocompleteHistoryManager(AutofillDriver* driver,
AutofillClient* autofill_client);
virtual ~AutocompleteHistoryManager() override;
~AutocompleteHistoryManager() override;

// WebDataServiceConsumer implementation.
virtual void OnWebDataServiceRequestDone(
WebDataServiceBase::Handle h, const WDTypedResult* result) override;
void OnWebDataServiceRequestDone(WebDataServiceBase::Handle h,
const WDTypedResult* result) override;

// Pass-through functions that are called by AutofillManager, after it has
// dispatched a message.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,15 @@ class AutocompleteHistoryManagerTest : public testing::Test {
protected:
AutocompleteHistoryManagerTest() {}

virtual void SetUp() override {
void SetUp() override {
web_data_service_ = new MockWebDataService();
autofill_client_.reset(new MockAutofillClient(web_data_service_));
autofill_driver_.reset(new TestAutofillDriver());
autocomplete_manager_.reset(new AutocompleteHistoryManager(
autofill_driver_.get(), autofill_client_.get()));
}

virtual void TearDown() override {
autocomplete_manager_.reset();
}
void TearDown() override { autocomplete_manager_.reset(); }

base::MessageLoop message_loop_;
scoped_refptr<MockWebDataService> web_data_service_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class MockAutofillManager : public AutofillManager {

class AutofillExternalDelegateUnitTest : public testing::Test {
protected:
virtual void SetUp() override {
void SetUp() override {
autofill_driver_.reset(new MockAutofillDriver());
autofill_manager_.reset(
new MockAutofillManager(autofill_driver_.get(), &autofill_client_));
Expand All @@ -106,7 +106,7 @@ class AutofillExternalDelegateUnitTest : public testing::Test {
autofill_manager_.get(), autofill_driver_.get()));
}

virtual void TearDown() override {
void TearDown() override {
// Order of destruction is important as AutofillManager relies on
// PersonalDataManager to be around when it gets destroyed.
autofill_manager_.reset();
Expand Down
4 changes: 2 additions & 2 deletions components/autofill/core/browser/autofill_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ class TestAutofillExternalDelegate : public AutofillExternalDelegate {

class AutofillManagerTest : public testing::Test {
public:
virtual void SetUp() override {
void SetUp() override {
autofill_client_.SetPrefs(test::PrefServiceForTesting());
personal_data_.set_database(autofill_client_.GetDatabase());
personal_data_.SetPrefService(autofill_client_.GetPrefs());
Expand All @@ -605,7 +605,7 @@ class AutofillManagerTest : public testing::Test {
autofill_manager_->SetExternalDelegate(external_delegate_.get());
}

virtual void TearDown() override {
void TearDown() override {
// Order of destruction is important as AutofillManager relies on
// PersonalDataManager to be around when it gets destroyed.
autofill_manager_.reset();
Expand Down
4 changes: 2 additions & 2 deletions components/autofill/core/browser/autofill_merge_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,10 @@ class AutofillMergeTest : public testing::Test,
public DataDrivenTest {
protected:
AutofillMergeTest();
virtual ~AutofillMergeTest();
~AutofillMergeTest() override;

// testing::Test:
virtual void SetUp();
void SetUp() override;

// DataDrivenTest:
void GenerateResults(const std::string& input, std::string* output) override;
Expand Down
6 changes: 3 additions & 3 deletions components/autofill/core/browser/autofill_metrics_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,10 +231,10 @@ class TestAutofillManager : public AutofillManager {

class AutofillMetricsTest : public testing::Test {
public:
virtual ~AutofillMetricsTest();
~AutofillMetricsTest() override;

virtual void SetUp() override;
virtual void TearDown() override;
void SetUp() override;
void TearDown() override;

protected:
base::MessageLoop message_loop_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace {
class AutofillQueryXmlParserTest : public testing::Test {
public:
AutofillQueryXmlParserTest(): upload_required_(USE_UPLOAD_RATES) {};
virtual ~AutofillQueryXmlParserTest() {};
~AutofillQueryXmlParserTest() override{};

protected:
void ParseQueryXML(const std::string& xml, bool should_succeed) {
Expand All @@ -37,7 +37,7 @@ class AutofillQueryXmlParserTest : public testing::Test {
class AutofillUploadXmlParserTest : public testing::Test {
public:
AutofillUploadXmlParserTest(): positive_(0), negative_(0) {};
virtual ~AutofillUploadXmlParserTest() {};
~AutofillUploadXmlParserTest() override{};

protected:
void ParseUploadXML(const std::string& xml, bool should_succeed) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace autofill {
class CreditCardFieldTest : public testing::Test {
public:
CreditCardFieldTest() {}
virtual ~CreditCardFieldTest() {}
~CreditCardFieldTest() override {}

protected:
ScopedVector<AutofillField> list_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ class PersonalDataManagerTest : public testing::Test {
protected:
PersonalDataManagerTest() {}

virtual void SetUp() {
void SetUp() override {
prefs_ = test::PrefServiceForTesting();
ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
base::FilePath path = temp_dir_.path().AppendASCII("TestWebDB");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,7 @@ class AutofillProfileSyncableServiceTest : public testing::Test {
public:
AutofillProfileSyncableServiceTest() {}

virtual void SetUp() override {
sync_processor_.reset(new MockSyncChangeProcessor);
}
void SetUp() override { sync_processor_.reset(new MockSyncChangeProcessor); }

// Wrapper around AutofillProfileSyncableService::MergeDataAndStartSyncing()
// that also verifies expectations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ int GetAutofillEntryCount(const base::string16& name,
class AutofillTableTest : public testing::Test {
public:
AutofillTableTest() {}
virtual ~AutofillTableTest() {}
~AutofillTableTest() override {}

protected:
virtual void SetUp() {
void SetUp() override {
#if defined(OS_MACOSX)
OSCrypt::UseMockKeychain(true);
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class WebDataServiceTest : public testing::Test {
WebDataServiceTest() : db_thread_("DBThread") {}

protected:
virtual void SetUp() {
void SetUp() override {
db_thread_.Start();

ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
Expand All @@ -116,7 +116,7 @@ class WebDataServiceTest : public testing::Test {
wds_->Init();
}

virtual void TearDown() {
void TearDown() override {
wds_->ShutdownOnUIThread();
wdbs_->ShutdownDatabase();
wds_ = NULL;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ scoped_ptr<PrefService> PrefServiceForTesting() {
class BookmarkExpandedStateTrackerTest : public testing::Test {
public:
BookmarkExpandedStateTrackerTest();
virtual ~BookmarkExpandedStateTrackerTest();
~BookmarkExpandedStateTrackerTest() override;

protected:
// testing::Test:
virtual void SetUp() override;
virtual void TearDown() override;
void SetUp() override;
void TearDown() override;

base::MessageLoop message_loop_;
TestBookmarkClient client_;
Expand Down
4 changes: 2 additions & 2 deletions components/bookmarks/browser/bookmark_node_data_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ class BookmarkNodeDataTest : public testing::Test {
public:
BookmarkNodeDataTest() {}

virtual void SetUp() override {
void SetUp() override {
event_source_ = ui::PlatformEventSource::CreateDefault();
model_ = client_.CreateModel();
test::WaitForBookmarkModelToLoad(model_.get());
bool success = profile_dir_.CreateUniqueTempDir();
ASSERT_TRUE(success);
}

virtual void TearDown() override {
void TearDown() override {
model_.reset();
event_source_.reset();
bool success = profile_dir_.Delete();
Expand Down
4 changes: 2 additions & 2 deletions components/bookmarks/browser/bookmark_utils_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ class BookmarkUtilsTest : public testing::Test,
BookmarkUtilsTest()
: grouped_changes_beginning_count_(0),
grouped_changes_ended_count_(0) {}
virtual ~BookmarkUtilsTest() {}
~BookmarkUtilsTest() override {}

// Copy and paste is not yet supported on iOS. http://crbug.com/228147
#if !defined(OS_IOS)
virtual void TearDown() override {
void TearDown() override {
ui::Clipboard::DestroyClipboardForCurrentThread();
}
#endif // !defined(OS_IOS)
Expand Down
8 changes: 3 additions & 5 deletions components/captive_portal/captive_portal_detector_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ class CaptivePortalDetectorTest : public testing::Test,
public CaptivePortalDetectorTestBase {
public:
CaptivePortalDetectorTest() {}
virtual ~CaptivePortalDetectorTest() {}
~CaptivePortalDetectorTest() override {}

virtual void SetUp() override {
void SetUp() override {
CHECK(base::MessageLoopProxy::current().get());
scoped_refptr<net::URLRequestContextGetter> request_context_getter(
new net::TestURLRequestContextGetter(
Expand All @@ -64,9 +64,7 @@ class CaptivePortalDetectorTest : public testing::Test,
set_detector(detector_.get());
}

virtual void TearDown() override {
detector_.reset();
}
void TearDown() override { detector_.reset(); }

void RunTest(const CaptivePortalDetector::Results& expected_results,
int net_error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const char binary_output_hash[] =
class ComponentPatcherOperationTest : public testing::Test {
public:
explicit ComponentPatcherOperationTest();
virtual ~ComponentPatcherOperationTest();
~ComponentPatcherOperationTest() override;

protected:
base::ScopedTempDir input_dir_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ namespace component_updater {
class ComponentUpdaterPingManagerTest : public testing::Test {
public:
ComponentUpdaterPingManagerTest();
virtual ~ComponentUpdaterPingManagerTest() {}
~ComponentUpdaterPingManagerTest() override {}

void RunThreadsUntilIdle();

// Overrides from testing::Test.
virtual void SetUp() override;
virtual void TearDown() override;
void SetUp() override;
void TearDown() override;

protected:
scoped_ptr<TestConfigurator> config_;
Expand Down
6 changes: 3 additions & 3 deletions components/component_updater/test/crx_downloader_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ base::FilePath MakeTestFilePath(const char* file) {
class CrxDownloaderTest : public testing::Test {
public:
CrxDownloaderTest();
virtual ~CrxDownloaderTest();
~CrxDownloaderTest() override;

// Overrides from testing::Test.
virtual void SetUp() override;
virtual void TearDown() override;
void SetUp() override;
void TearDown() override;

void Quit();
void RunThreads();
Expand Down
6 changes: 3 additions & 3 deletions components/component_updater/test/request_sender_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ const char kUrlPath2[] = "path2";
class RequestSenderTest : public testing::Test {
public:
RequestSenderTest();
virtual ~RequestSenderTest();
~RequestSenderTest() override;

// Overrides from testing::Test.
virtual void SetUp() override;
virtual void TearDown() override;
void SetUp() override;
void TearDown() override;

void RequestSenderComplete(const net::URLFetcher* source);

Expand Down
Loading

0 comments on commit 30a1b15

Please sign in to comment.