def main():
    logging.basicConfig(
        level=logging.INFO,
        format='[%(asctime)s %(levelname)s %(name)s] %(message)s',
        datefmt='%H:%M:%S')
    parser = argparse.ArgumentParser(description='Blink source mover')
    sub_parsers = parser.add_subparsers()

    update_parser = sub_parsers.add_parser('update')
    update_parser.set_defaults(command='update')
    update_parser.add_argument(
        '--run', dest='run', action='store_true', help='Update file contents')

    move_parser = sub_parsers.add_parser('move')
    move_parser.set_defaults(command='move')
    move_parser.add_argument(
        '--git',
        dest='run_git',
        action='store_true',
        help='Run |git mv| command instead of |mv|.')

    fixbranch_parser = sub_parsers.add_parser('fixbranch')
    fixbranch_parser.set_defaults(command='fixbranch', run=True, run_git=True)

    options = parser.parse_args()
    mover = MoveBlinkSource(FileSystem(), options, get_chromium_src_dir())
    if options.command == 'update':
        mover.update()
    elif options.command == 'move':
        mover.move()
    elif options.command == 'fixbranch':
        mover.fix_branch()
def _import_android_packages_if_necessary():
    # pylint: disable=invalid-name
    global battery_utils
    global device_errors
    global device_utils
    global devil_chromium
    global devil_env
    global intent
    global perf_control
    # pylint: enable=invalid-name

    if not battery_utils:
        chromium_src_root = get_chromium_src_dir()
        devil_root = os.path.join(chromium_src_root, 'third_party', 'catapult',
                                  'devil')
        build_android_root = os.path.join(chromium_src_root, 'build',
                                          'android')
        sys.path.insert(0, devil_root)
        sys.path.insert(0, build_android_root)
        from importlib import import_module

        battery_utils = import_module('devil.android.battery_utils')
        devil_env = import_module('devil.devil_env')
        device_errors = import_module('devil.android.device_errors')
        device_utils = import_module('devil.android.device_utils')
        devil_chromium = import_module('devil_chromium')
        intent = import_module('devil.android.sdk.intent')
        perf_control = import_module('devil.android.perf.perf_control')
Exemple #3
0
def _import_fuchsia_runner():
    sys.path.insert(0, os.path.join(get_chromium_src_dir(), 'build/fuchsia'))

    # pylint: disable=import-error
    # pylint: disable=invalid-name
    # pylint: disable=redefined-outer-name
    global fuchsia_target
    import target as fuchsia_target
    global qemu_target
    import qemu_target as qemu_target
Exemple #4
0
def _import_fuchsia_runner():
    sys.path.insert(0, os.path.join(get_chromium_src_dir(), 'build/fuchsia'))

    # pylint: disable=import-error
    # pylint: disable=invalid-name
    # pylint: disable=redefined-outer-name
    global aemu_target
    import aemu_target
    global _GetPathToBuiltinTarget, _LoadTargetClass
    from common_args import _GetPathToBuiltinTarget, _LoadTargetClass
    global device_target
    import device_target
    global fuchsia_target
    import target as fuchsia_target
    global qemu_target
    import qemu_target
    global symbolizer
    import symbolizer
import optparse
import os
import sys
import time
import unittest

from blinkpy.common.path_finder import get_chromium_src_dir
from blinkpy.common.system.executive_mock import MockExecutive
from blinkpy.common.system.system_host_mock import MockSystemHost
from blinkpy.web_tests.port import android
from blinkpy.web_tests.port import driver_unittest
from blinkpy.web_tests.port import port_testcase
from blinkpy.web_tests.models.test_expectations import TestExpectations

_DEVIL_ROOT = os.path.join(get_chromium_src_dir(), 'third_party', 'catapult',
                           'devil')
sys.path.insert(0, _DEVIL_ROOT)
from devil.android import device_utils
from devil.android.sdk import adb_wrapper

_MOCK_ROOT = os.path.join(get_chromium_src_dir(), 'third_party', 'pymock')
sys.path.insert(0, _MOCK_ROOT)
import mock


def mock_devices():
    serials = [
        '123456789ABCDEF0', '123456789ABCDEF1', '123456789ABCDEF2',
        '123456789ABCDEF3', '123456789ABCDEF4', '123456789ABCDEF5'
    ]
import optparse
import os
import sys
import time
import unittest

from blinkpy.common.path_finder import get_chromium_src_dir
from blinkpy.common.system.executive_mock import MockExecutive
from blinkpy.common.system.system_host_mock import MockSystemHost
from blinkpy.web_tests.port import android
from blinkpy.web_tests.port import driver_unittest
from blinkpy.web_tests.port import port_testcase

_DEVIL_ROOT = os.path.join(
    get_chromium_src_dir(), 'third_party', 'catapult', 'devil')
sys.path.append(_DEVIL_ROOT)
from devil.android import device_utils
from devil.android.sdk import adb_wrapper

_MOCK_ROOT = os.path.join(
    get_chromium_src_dir(), 'third_party', 'pymock')
sys.path.append(_MOCK_ROOT)
import mock


def mock_devices():
    serials = ['123456789ABCDEF0', '123456789ABCDEF1', '123456789ABCDEF2',
               '123456789ABCDEF3', '123456789ABCDEF4', '123456789ABCDEF5']
    devices = []
    for serial in serials:
# 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.

import os
import sys
import unittest

from blinkpy.common import path_finder
from blinkpy.common.host_mock import MockHost
from blinkpy.web_tests.controllers import web_test_finder

_MOCK_ROOT = os.path.join(path_finder.get_chromium_src_dir(), 'third_party',
                          'pymock')
sys.path.insert(0, _MOCK_ROOT)
import mock


class WebTestFinderTests(unittest.TestCase):
    def test_find_fastest_tests(self):
        host = MockHost()
        port = host.port_factory.get('test-win-win7', None)

        all_tests = [
            'path/test.html',
            'new/test.html',
            'fast/css/1.html',
            'fast/css/2.html',
            'fast/css/3.html',
            'fast/css/skip1.html',
            'fast/css/skip2.html',
# 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.

import os
import sys
import unittest

from blinkpy.common import path_finder
from blinkpy.common.host_mock import MockHost
from blinkpy.web_tests.controllers import web_test_finder

_MOCK_ROOT = os.path.join(
    path_finder.get_chromium_src_dir(), 'third_party', 'pymock')
sys.path.append(_MOCK_ROOT)
import mock


class WebTestFinderTests(unittest.TestCase):

    def test_find_fastest_tests(self):
        host = MockHost()
        port = host.port_factory.get('test-win-win7', None)

        all_tests = [
            'path/test.html',
            'new/test.html',
            'fast/css/1.html',
            'fast/css/2.html',
            'fast/css/3.html',
            'fast/css/skip1.html',