| OLD | NEW | 
|---|
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2011 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 """Samples patches to test patch.py.""" | 5 """Samples patches to test patch.py.""" | 
| 6 | 6 | 
| 7 | 7 | 
| 8 class RAW(object): | 8 class RAW(object): | 
| 9   PATCH = ( | 9   PATCH = ( | 
| 10       'Index: chrome/file.cc\n' | 10       'Index: chrome/file.cc\n' | 
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 47   DELETE = ( | 47   DELETE = ( | 
| 48       '--- tools/clang_check/README.chromium\n' | 48       '--- tools/clang_check/README.chromium\n' | 
| 49       '+++ /dev/null\n' | 49       '+++ /dev/null\n' | 
| 50       '@@ -1,1 +0,0 @@\n' | 50       '@@ -1,1 +0,0 @@\n' | 
| 51       '-bar\n') | 51       '-bar\n') | 
| 52 | 52 | 
| 53   MINIMAL_DELETE = ( | 53   MINIMAL_DELETE = ( | 
| 54       '--- chrome/file.cc\tbar\n' | 54       '--- chrome/file.cc\tbar\n' | 
| 55       '+++ /dev/null\tfoo\n') | 55       '+++ /dev/null\tfoo\n') | 
| 56 | 56 | 
|  | 57   DELETE2 = ( | 
|  | 58       'Index: browser/extensions/extension_sidebar_api.cc\n' | 
|  | 59       '===================================================================\n' | 
|  | 60       '--- browser/extensions/extension_sidebar_api.cc\t(revision 116830)\n' | 
|  | 61       '+++ browser/extensions/extension_sidebar_api.cc\t(working copy)\n' | 
|  | 62       '@@ -1,19 +0,0 @@\n' | 
|  | 63       '-// Copyright (c) 2011 The Chromium Authors. All rights reserved.\n' | 
|  | 64       '-// Use of this source code is governed by a BSD-style license that\n' | 
|  | 65       '-// found in the LICENSE file.\n' | 
|  | 66       '-\n' | 
|  | 67       '-#include "base/command_line.h"\n' | 
|  | 68       '-#include "chrome/browser/extensions/extension_apitest.h"\n' | 
|  | 69       '-#include "chrome/common/chrome_switches.h"\n' | 
|  | 70       '-\n' | 
|  | 71       '-class SidebarApiTest : public ExtensionApiTest {\n' | 
|  | 72       '- public:\n' | 
|  | 73       '-  void SetUpCommandLine(CommandLine* command_line) {\n' | 
|  | 74       '-    ExtensionApiTest::SetUpCommandLine(command_line);\n' | 
|  | 75       '-    command_line->AppendSwitch(switches::Bleh);\n' | 
|  | 76       '-  }\n' | 
|  | 77       '-};\n' | 
|  | 78       '-\n' | 
|  | 79       '-IN_PROC_BROWSER_TEST_F(SidebarApiTest, Sidebar) {\n' | 
|  | 80       '-  ASSERT_TRUE(RunExtensionTest("sidebar")) << message_;\n' | 
|  | 81       '-}\n') | 
|  | 82 | 
| 57   # http://codereview.chromium.org/api/7530007/5001 | 83   # http://codereview.chromium.org/api/7530007/5001 | 
| 58   # http://codereview.chromium.org/download/issue7530007_5001_4011.diff | 84   # http://codereview.chromium.org/download/issue7530007_5001_4011.diff | 
| 59   CRAP_ONLY = ( | 85   CRAP_ONLY = ( | 
| 60       'Index: scripts/master/factory/skia/__init__.py\n' | 86       'Index: scripts/master/factory/skia/__init__.py\n' | 
| 61       '===================================================================\n') | 87       '===================================================================\n') | 
| 62 | 88 | 
|  | 89   TWO_HUNKS = ( | 
|  | 90       'Index: chrome/app/generated_resources.grd\n' | 
|  | 91       '===================================================================\n' | 
|  | 92       '--- chrome/app/generated_resources.grd\t(revision 116830)\n' | 
|  | 93       '+++ chrome/app/generated_resources.grd\t(working copy)\n' | 
|  | 94       '@@ -4169,9 +4169,6 @@\n' | 
|  | 95       '       <message name="IDS_EXTENSION_LOAD_OPTIONS_PAGE_FAILED" desc="">\n' | 
|  | 96       '   Could not load options page \'<ph name="OPTIONS_PAGE">$1<ex....\n' | 
|  | 97       ' </message>\n' | 
|  | 98       '-      <message name="IDS_EXTENSION_LOAD_SIDEBAR_PAGE_FAILED" desc="">\n' | 
|  | 99       '-        Could not load sidebar page \'<ph name="SIDEBAR_PAGE">$1<e...\n' | 
|  | 100       '-      </message>\n' | 
|  | 101       '       <if expr="is_win">\n' | 
|  | 102       '         <message name="IDS_EXTENSION_UNPACK_FAILED" desc="On wind...\n' | 
|  | 103       '           Can not unpack extension.  To safely unpack an extensio...\n' | 
|  | 104       '@@ -5593,9 +5590,6 @@\n' | 
|  | 105       '       <message name="IDS_ACCNAME_WEB_CONTENTS" desc="The acces...\n' | 
|  | 106       '         Web Contents\n' | 
|  | 107       '       </message>\n' | 
|  | 108       '-      <message name="IDS_ACCNAME_SIDE_BAR" desc="The acces...\n' | 
|  | 109       '-        Sidebar\n' | 
|  | 110       '-      </message>\n' | 
|  | 111       ' \n' | 
|  | 112       '       <!-- Browser Hung Plugin Detector -->\n' | 
|  | 113       '       <message name="IDS_UNKNOWN_PLUGIN_NAME" ...\n') | 
| 63 | 114 | 
| 64 class GIT(object): | 115 class GIT(object): | 
| 65   """Sample patches generated by git diff.""" | 116   """Sample patches generated by git diff.""" | 
| 66   PATCH = ( | 117   PATCH = ( | 
| 67       'diff --git a/chrome/file.cc b/chrome/file.cc\n' | 118       'diff --git a/chrome/file.cc b/chrome/file.cc\n' | 
| 68       'index 0e4de76..8320059 100644\n' | 119       'index 0e4de76..8320059 100644\n' | 
| 69       '--- a/chrome/file.cc\n' | 120       '--- a/chrome/file.cc\n' | 
| 70       '+++ b/chrome/file.cc\n' | 121       '+++ b/chrome/file.cc\n' | 
| 71       '@@ -3,6 +3,7 @@ bb\n' | 122       '@@ -3,6 +3,7 @@ bb\n' | 
| 72       ' ccc\n' | 123       ' ccc\n' | 
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 199   MODE_EXE = ( | 250   MODE_EXE = ( | 
| 200       'diff --git a/git_cl/git-cl b/git_cl/git-cl\n' | 251       'diff --git a/git_cl/git-cl b/git_cl/git-cl\n' | 
| 201       'old mode 100644\n' | 252       'old mode 100644\n' | 
| 202       'new mode 100755\n') | 253       'new mode 100755\n') | 
| 203 | 254 | 
| 204   MODE_EXE_JUNK = ( | 255   MODE_EXE_JUNK = ( | 
| 205       'Index: Junk\n' | 256       'Index: Junk\n' | 
| 206       'diff --git a/git_cl/git-cl b/git_cl/git-cl\n' | 257       'diff --git a/git_cl/git-cl b/git_cl/git-cl\n' | 
| 207       'old mode 100644\n' | 258       'old mode 100644\n' | 
| 208       'new mode 100755\n') | 259       'new mode 100755\n') | 
|  | 260 | 
|  | 261   FOUR_HUNKS = ( | 
|  | 262       'Index: presubmit_support.py\n' | 
|  | 263       'diff --git a/presubmit_support.py b/presubmit_support.py\n' | 
|  | 264       'index 52416d3f..d56512f2 100755\n' | 
|  | 265       '--- a/presubmit_support.py\n' | 
|  | 266       '+++ b/presubmit_support.py\n' | 
|  | 267       '@@ -558,6 +558,7 @@ class SvnAffectedFile(AffectedFile):\n' | 
|  | 268       '     AffectedFile.__init__(self, *args, **kwargs)\n' | 
|  | 269       '     self._server_path = None\n' | 
|  | 270       '     self._is_text_file = None\n' | 
|  | 271       '+    self._diff = None\n' | 
|  | 272       ' \n' | 
|  | 273       '   def ServerPath(self):\n' | 
|  | 274       '     if self._server_path is None:\n' | 
|  | 275       '@@ -598,8 +599,10 @@ class SvnAffectedFile(AffectedFile):\n' | 
|  | 276       '     return self._is_text_file\n' | 
|  | 277       ' \n' | 
|  | 278       '   def GenerateScmDiff(self):\n' | 
|  | 279       '-    return scm.SVN.GenerateDiff(\n' | 
|  | 280       '-        [self.LocalPath()], self._local_root, False, None)\n' | 
|  | 281       '+    if self._diff is None:\n' | 
|  | 282       '+      self._diff = scm.SVN.GenerateDiff(\n' | 
|  | 283       '+          [self.LocalPath()], self._local_root, False, None)\n' | 
|  | 284       '+    return self._diff\n' | 
|  | 285       ' \n' | 
|  | 286       ' \n' | 
|  | 287       ' class GitAffectedFile(AffectedFile):\n' | 
|  | 288       '@@ -611,6 +614,7 @@ class GitAffectedFile(AffectedFile):\n' | 
|  | 289       '     AffectedFile.__init__(self, *args, **kwargs)\n' | 
|  | 290       '     self._server_path = None\n' | 
|  | 291       '     self._is_text_file = None\n' | 
|  | 292       '+    self._diff = None\n' | 
|  | 293       ' \n' | 
|  | 294       '   def ServerPath(self):\n' | 
|  | 295       '     if self._server_path is None:\n' | 
|  | 296       '@@ -645,7 +649,10 @@ class GitAffectedFile(AffectedFile):\n' | 
|  | 297       '     return self._is_text_file\n' | 
|  | 298       ' \n' | 
|  | 299       '   def GenerateScmDiff(self):\n' | 
|  | 300       '-    return scm.GIT.GenerateDiff(self._local_root, files=[self.Lo...\n' | 
|  | 301       '+    if self._diff is None:\n' | 
|  | 302       '+      self._diff = scm.GIT.GenerateDiff(\n' | 
|  | 303       '+          self._local_root, files=[self.LocalPath(),])\n' | 
|  | 304       '+    return self._diff\n' | 
|  | 305       ' \n' | 
|  | 306       ' \n' | 
|  | 307       ' class Change(object):\n') | 
| OLD | NEW | 
|---|