Index: tools/clang/rewrite_to_chrome_style/tests/methods-expected.cc |
diff --git a/tools/clang/rewrite_to_chrome_style/tests/methods-expected.cc b/tools/clang/rewrite_to_chrome_style/tests/methods-expected.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e37223f940993e6589ae27df9710c2784a8bd39f |
--- /dev/null |
+++ b/tools/clang/rewrite_to_chrome_style/tests/methods-expected.cc |
@@ -0,0 +1,49 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+namespace blink { |
+ |
+class Task { |
+ public: |
+ // Already style-compliant methods shouldn't change. |
+ void OutputDebugString() {} |
+ |
+ // Tests that the declarations for methods are updated. |
+ void DoTheWork(); |
+ virtual void ReallyDoTheWork() = 0; |
+ |
+ // Note: this is purposely copyable and assignable, to make sure the Clang |
+ // tool doesn't try to emit replacements for things that aren't explicitly |
+ // written. |
+ // TODO(dcheng): Add an explicit test for something like operator+. |
+}; |
+ |
+// Test that the actual method definition is also updated. |
+void Task::DoTheWork() { |
+ ReallyDoTheWork(); |
+} |
+ |
+} // namespace blink |
+ |
+namespace Moo { |
+ |
+// Test that overrides from outside the Blink namespace are also updated. |
+class BovineTask : public blink::Task { |
+ public: |
+ void ReallyDoTheWork() override; |
+}; |
+ |
+void BovineTask::ReallyDoTheWork() { |
+ DoTheWork(); |
+ // Calls via an overridden method should also be updated. |
+ ReallyDoTheWork(); |
+} |
+ |
+// Finally, test that method pointers are also updated. |
+void F() { |
+ void (blink::Task::*p1)() = &BovineTask::DoTheWork; |
+ void (blink::Task::*p2)() = &blink::Task::ReallyDoTheWork; |
+} |
+ |
+} // namespace Moo |