| Index: tests/gclient_smoketest.py
 | 
| diff --git a/tests/gclient_smoketest.py b/tests/gclient_smoketest.py
 | 
| index eb2275e059782a0e28837d438f3e266f8278127a..71b5aba96a7d1436af4cf5022bb77f2c2ef65f9d 100755
 | 
| --- a/tests/gclient_smoketest.py
 | 
| +++ b/tests/gclient_smoketest.py
 | 
| @@ -22,7 +22,7 @@ sys.path.insert(0, ROOT_DIR)
 | 
|  
 | 
|  from testing_support.fake_repos import join, write
 | 
|  from testing_support.fake_repos import FakeReposTestBase, FakeRepoTransitive, \
 | 
| -                                       FakeRepoSkiaDEPS
 | 
| +                                       FakeRepoSkiaDEPS, FakeRepoBlinkDEPS
 | 
|  
 | 
|  import gclient_utils
 | 
|  import scm as gclient_scm
 | 
| @@ -1538,6 +1538,136 @@ class SkiaDEPSTransitionSmokeTest(GClientSmokeBase):
 | 
|                                               skia_src), src_git_url)
 | 
|  
 | 
|  
 | 
| +class BlinkDEPSTransitionSmokeTest(GClientSmokeBase):
 | 
| +  """Simulate the behavior of bisect bots as they transition across the Blink
 | 
| +  DEPS change."""
 | 
| +
 | 
| +  FAKE_REPOS_CLASS = FakeRepoBlinkDEPS
 | 
| +
 | 
| +  def setUp(self):
 | 
| +    super(BlinkDEPSTransitionSmokeTest, self).setUp()
 | 
| +    self.enabled = self.FAKE_REPOS.set_up_git()
 | 
| +    self.checkout_path = os.path.join(self.root_dir, 'src')
 | 
| +    self.blink = os.path.join(self.checkout_path, 'third_party', 'WebKit')
 | 
| +    self.blink_git_url = self.FAKE_REPOS.git_base + 'repo_2'
 | 
| +    self.pre_merge_sha = self.githash('repo_1', 1)
 | 
| +    self.post_merge_sha = self.githash('repo_1', 2)
 | 
| +
 | 
| +  def CheckStatusPreMergePoint(self):
 | 
| +    self.assertEqual(gclient_scm.GIT.Capture(['config', 'remote.origin.url'],
 | 
| +                                             self.blink), self.blink_git_url)
 | 
| +    self.assertTrue(os.path.exists(join(self.blink, '.git')))
 | 
| +    self.assertTrue(os.path.exists(join(self.blink, 'OWNERS')))
 | 
| +    with open(join(self.blink, 'OWNERS')) as f:
 | 
| +      owners_content = f.read()
 | 
| +      self.assertEqual('OWNERS-pre', owners_content, 'OWNERS not updated')
 | 
| +    self.assertTrue(os.path.exists(join(self.blink, 'Source', 'exists_always')))
 | 
| +    self.assertTrue(os.path.exists(
 | 
| +        join(self.blink, 'Source', 'exists_before_but_not_after')))
 | 
| +    self.assertFalse(os.path.exists(
 | 
| +        join(self.blink, 'Source', 'exists_after_but_not_before')))
 | 
| +
 | 
| +  def CheckStatusPostMergePoint(self):
 | 
| +    # Check that the contents still exists
 | 
| +    self.assertTrue(os.path.exists(join(self.blink, 'OWNERS')))
 | 
| +    with open(join(self.blink, 'OWNERS')) as f:
 | 
| +      owners_content = f.read()
 | 
| +      self.assertEqual('OWNERS-post', owners_content, 'OWNERS not updated')
 | 
| +    self.assertTrue(os.path.exists(join(self.blink, 'Source', 'exists_always')))
 | 
| +    # Check that file removed between the branch point are actually deleted.
 | 
| +    self.assertTrue(os.path.exists(
 | 
| +        join(self.blink, 'Source', 'exists_after_but_not_before')))
 | 
| +    self.assertFalse(os.path.exists(
 | 
| +        join(self.blink, 'Source', 'exists_before_but_not_after')))
 | 
| +    # But not the .git folder
 | 
| +    self.assertFalse(os.path.exists(join(self.blink, '.git')))
 | 
| +
 | 
| +  def testBlinkDEPSChangeUsingGclient(self):
 | 
| +    """Checks that {src,blink} repos are consistent when syncing going back and
 | 
| +    forth using gclient sync src@revision."""
 | 
| +    if not self.enabled:
 | 
| +      return
 | 
| +
 | 
| +    self.gclient(['config', '--spec',
 | 
| +        'solutions=['
 | 
| +        '{"name": "src",'
 | 
| +        ' "url": "' + self.git_base + 'repo_1",'
 | 
| +        '}]'])
 | 
| +
 | 
| +    # Go back and forth two times.
 | 
| +    for _ in xrange(2):
 | 
| +      res = self.gclient(['sync', '--revision', 'src@%s' % self.pre_merge_sha])
 | 
| +      self.assertEqual(res[2], 0, 'DEPS change sync failed.')
 | 
| +      self.CheckStatusPreMergePoint()
 | 
| +
 | 
| +      res = self.gclient(['sync', '--revision', 'src@%s' % self.post_merge_sha])
 | 
| +      self.assertEqual(res[2], 0, 'DEPS change sync failed.')
 | 
| +      self.CheckStatusPostMergePoint()
 | 
| +
 | 
| +
 | 
| +  def testBlinkDEPSChangeUsingGit(self):
 | 
| +    """Like testBlinkDEPSChangeGit, but move the main project using directly
 | 
| +    git and not gclient sync."""
 | 
| +    if not self.enabled:
 | 
| +      return
 | 
| +
 | 
| +    self.gclient(['config', '--spec',
 | 
| +        'solutions=['
 | 
| +        '{"name": "src",'
 | 
| +        ' "url": "' + self.git_base + 'repo_1",'
 | 
| +        ' "managed": False,'
 | 
| +        '}]'])
 | 
| +
 | 
| +    # Perform an initial sync to bootstrap the repo.
 | 
| +    res = self.gclient(['sync'])
 | 
| +    self.assertEqual(res[2], 0, 'Initial gclient sync failed.')
 | 
| +
 | 
| +    # Go back and forth two times.
 | 
| +    for _ in xrange(2):
 | 
| +      subprocess2.check_call(['git', 'checkout', '-q', self.pre_merge_sha],
 | 
| +                             cwd=self.checkout_path)
 | 
| +      res = self.gclient(['sync'])
 | 
| +      self.assertEqual(res[2], 0, 'gclient sync failed.')
 | 
| +      self.CheckStatusPreMergePoint()
 | 
| +
 | 
| +      subprocess2.check_call(['git', 'checkout', '-q', self.post_merge_sha],
 | 
| +                             cwd=self.checkout_path)
 | 
| +      res = self.gclient(['sync'])
 | 
| +      self.assertEqual(res[2], 0, 'DEPS change sync failed.')
 | 
| +      self.CheckStatusPostMergePoint()
 | 
| +
 | 
| +
 | 
| +  def testBlinkLocalBranchesArePreserved(self):
 | 
| +    """Checks that the state of local git branches are effectively preserved
 | 
| +    when going back and forth."""
 | 
| +    if not self.enabled:
 | 
| +      return
 | 
| +
 | 
| +    self.gclient(['config', '--spec',
 | 
| +        'solutions=['
 | 
| +        '{"name": "src",'
 | 
| +        ' "url": "' + self.git_base + 'repo_1",'
 | 
| +        '}]'])
 | 
| +
 | 
| +    # Initialize to pre-merge point.
 | 
| +    self.gclient(['sync', '--revision', 'src@%s' % self.pre_merge_sha])
 | 
| +    self.CheckStatusPreMergePoint()
 | 
| +
 | 
| +    # Create a branch named "foo".
 | 
| +    subprocess2.check_call(['git', 'checkout', '-qB', 'foo'],
 | 
| +                           cwd=self.blink)
 | 
| +
 | 
| +    # Cross the pre-merge point.
 | 
| +    self.gclient(['sync', '--revision', 'src@%s' % self.post_merge_sha])
 | 
| +    self.CheckStatusPostMergePoint()
 | 
| +
 | 
| +    # Go backwards and check that we still have the foo branch.
 | 
| +    self.gclient(['sync', '--revision', 'src@%s' % self.pre_merge_sha])
 | 
| +    self.CheckStatusPreMergePoint()
 | 
| +    subprocess2.check_call(
 | 
| +        ['git', 'show-ref', '-q', '--verify', 'refs/heads/foo'], cwd=self.blink)
 | 
| +
 | 
| +
 | 
|  class GClientSmokeFromCheckout(GClientSmokeBase):
 | 
|    # WebKit abuses this. It has a .gclient and a DEPS from a checkout.
 | 
|    def setUp(self):
 | 
| 
 |