Top-level files
This commit is contained in:
8
engine/src/flutter/.clang-format
Normal file
8
engine/src/flutter/.clang-format
Normal file
@@ -0,0 +1,8 @@
|
||||
# Defines the Chromium style for automatic reformatting.
|
||||
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
|
||||
BasedOnStyle: Chromium
|
||||
# This defaults to 'Auto'. Explicitly set it for a while, so that
|
||||
# 'vector<vector<int> >' in existing files gets formatted to
|
||||
# 'vector<vector<int>>'. ('Auto' means that clang-format will only use
|
||||
# 'int>>' if the file already contains at least one such instance.)
|
||||
Standard: Cpp11
|
||||
7
engine/src/flutter/.gitattributes
vendored
Normal file
7
engine/src/flutter/.gitattributes
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
## This page intentionally left blank. ##
|
||||
#
|
||||
# Workaround for VS2013 automatically creating .gitattributes files with
|
||||
# default settings that we don't want.
|
||||
# See also:
|
||||
# http://connect.microsoft.com/VisualStudio/feedback/details/804948/inappropriately-creates-gitattributes-file
|
||||
# http://crbug.com/342064
|
||||
97
engine/src/flutter/.gitignore
vendored
Normal file
97
engine/src/flutter/.gitignore
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
# commonly generated files
|
||||
*.pyc
|
||||
*~
|
||||
.*.sw?
|
||||
.DS_Store
|
||||
.classpath
|
||||
.cproject
|
||||
.gdb_history
|
||||
.gdbinit
|
||||
.landmines
|
||||
.project
|
||||
.pub
|
||||
.pydevproject
|
||||
.checkstyle
|
||||
cscope.*
|
||||
Session.vim
|
||||
tags
|
||||
Thumbs.db
|
||||
v8.log
|
||||
/build/util/LASTCHANGE*
|
||||
|
||||
# directories pulled in via deps or hooks
|
||||
/build/linux/bin/eu-strip
|
||||
/buildtools/
|
||||
/dart/
|
||||
/dart-pub-cache/
|
||||
/native_client/
|
||||
/out/
|
||||
/out_*/
|
||||
/sdch/open-vcdiff/
|
||||
/testing/gmock/
|
||||
/testing/gtest/
|
||||
/third_party/android_tools/
|
||||
/third_party/angle/
|
||||
/third_party/appurify-python/
|
||||
/third_party/boringssl/src/
|
||||
/third_party/brotli/src/
|
||||
/third_party/colorama/src/
|
||||
/third_party/dart-sdk/
|
||||
/third_party/dart-pkg/archive
|
||||
/third_party/dart-pkg/args
|
||||
/third_party/dart-pkg/box2d
|
||||
/third_party/dart-pkg/cassowary
|
||||
/third_party/dart-pkg/collection
|
||||
/third_party/dart-pkg/crypto
|
||||
/third_party/dart-pkg/newton
|
||||
/third_party/dart-pkg/path
|
||||
/third_party/dart-pkg/quiver
|
||||
/third_party/dart-pkg/source_span
|
||||
/third_party/dart-pkg/string_scanner
|
||||
/third_party/dart-pkg/vector_math
|
||||
/third_party/dart-pkg/vector_math
|
||||
/third_party/dart-pkg/yaml
|
||||
/third_party/dejavu-fonts-ttf-2.34/ttf/*.ttf
|
||||
/third_party/freetype-android/src
|
||||
/third_party/go/tool/
|
||||
/third_party/icu/
|
||||
/third_party/jsr-305/src/
|
||||
/third_party/libc++/trunk/
|
||||
/third_party/libc++abi/trunk/
|
||||
/third_party/libjpeg_turbo/
|
||||
/third_party/llvm/
|
||||
/third_party/llvm-build/
|
||||
/third_party/junit/src/
|
||||
/third_party/mesa/src/
|
||||
/third_party/mockito/src/
|
||||
/third_party/pdfium/
|
||||
/third_party/pywebsocket/src/
|
||||
/third_party/requests/src/
|
||||
/third_party/robolectric/src/
|
||||
/third_party/skia/
|
||||
/third_party/smhasher/src/
|
||||
/third_party/yasm/binaries/
|
||||
/third_party/yasm/source/patched-yasm/
|
||||
/tools/grit/
|
||||
/v8/
|
||||
|
||||
# dart packages directories and related.
|
||||
/mojo/dart/apptest/packages
|
||||
/mojo/dart/mojo_services/packages
|
||||
/mojo/dart/mojo_services/pubspec.lock
|
||||
/mojo/dart/mojom/bin/packages
|
||||
/mojo/dart/mojom/packages
|
||||
/mojo/dart/mojom/test/packages
|
||||
/sky/examples/hello_world/packages
|
||||
/sky/examples/stocks/packages
|
||||
/sky/sdk/packages/mojo/packages
|
||||
/sky/sdk/packages/mojo/pubspec.lock
|
||||
/sky/sdk/packages/sky/packages
|
||||
/sky/sdk/packages/sky/pubspec.lock
|
||||
|
||||
# sky tools
|
||||
/sky/tools/skygo/linux64/sky_server
|
||||
/sky/tools/skygo/mac/sky_server
|
||||
|
||||
# downloaded keyboard_native resources.
|
||||
/services/keyboard_native/res/*.png
|
||||
23
engine/src/flutter/.gn
Normal file
23
engine/src/flutter/.gn
Normal file
@@ -0,0 +1,23 @@
|
||||
# This file is used by the experimental meta-buildsystem in src/tools/gn to
|
||||
# find the root of the source tree and to set startup options.
|
||||
|
||||
# The location of the build configuration file.
|
||||
buildconfig = "//build/config/BUILDCONFIG.gn"
|
||||
|
||||
# The secondary source root is a parallel directory tree where
|
||||
# GN build files are placed when they can not be placed directly
|
||||
# in the source tree, e.g. for third party source trees.
|
||||
secondary_source = "//build/secondary/"
|
||||
|
||||
# The set of targets known to pass 'gn check'. When all targets pass, remove
|
||||
# this.
|
||||
check_targets = [
|
||||
"//crypto/*",
|
||||
"//dart/*",
|
||||
"//mojo/*",
|
||||
"//mojom/*",
|
||||
"//skia/*",
|
||||
"//sky/*",
|
||||
"//ui/*",
|
||||
"//url/*",
|
||||
]
|
||||
13
engine/src/flutter/BUILD.gn
Normal file
13
engine/src/flutter/BUILD.gn
Normal file
@@ -0,0 +1,13 @@
|
||||
# Copyright 2014 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.
|
||||
|
||||
# This target will be built if no target is specified when invoking ninja.
|
||||
group("default") {
|
||||
testonly = true
|
||||
|
||||
deps = [
|
||||
"//sky",
|
||||
"//services/sky",
|
||||
]
|
||||
}
|
||||
27
engine/src/flutter/LICENSE
Normal file
27
engine/src/flutter/LICENSE
Normal file
@@ -0,0 +1,27 @@
|
||||
// Copyright 2014 The Chromium Authors. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from
|
||||
// this software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
1
engine/src/flutter/OWNERS
Normal file
1
engine/src/flutter/OWNERS
Normal file
@@ -0,0 +1 @@
|
||||
*
|
||||
1134
engine/src/flutter/PRESUBMIT.py
Normal file
1134
engine/src/flutter/PRESUBMIT.py
Normal file
File diff suppressed because it is too large
Load Diff
357
engine/src/flutter/PRESUBMIT_test.py
Normal file
357
engine/src/flutter/PRESUBMIT_test.py
Normal file
@@ -0,0 +1,357 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2012 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 re
|
||||
import unittest
|
||||
|
||||
import PRESUBMIT
|
||||
from PRESUBMIT_test_mocks import MockChange, MockFile
|
||||
from PRESUBMIT_test_mocks import MockInputApi, MockOutputApi
|
||||
|
||||
|
||||
_TEST_DATA_DIR = 'base/test/data/presubmit'
|
||||
|
||||
|
||||
class IncludeOrderTest(unittest.TestCase):
|
||||
def testSystemHeaderOrder(self):
|
||||
scope = [(1, '#include <csystem.h>'),
|
||||
(2, '#include <cppsystem>'),
|
||||
(3, '#include "acustom.h"')]
|
||||
all_linenums = [linenum for (linenum, _) in scope]
|
||||
mock_input_api = MockInputApi()
|
||||
warnings = PRESUBMIT._CheckIncludeOrderForScope(scope, mock_input_api,
|
||||
'', all_linenums)
|
||||
self.assertEqual(0, len(warnings))
|
||||
|
||||
def testSystemHeaderOrderMismatch1(self):
|
||||
scope = [(10, '#include <cppsystem>'),
|
||||
(20, '#include <csystem.h>'),
|
||||
(30, '#include "acustom.h"')]
|
||||
all_linenums = [linenum for (linenum, _) in scope]
|
||||
mock_input_api = MockInputApi()
|
||||
warnings = PRESUBMIT._CheckIncludeOrderForScope(scope, mock_input_api,
|
||||
'', all_linenums)
|
||||
self.assertEqual(1, len(warnings))
|
||||
self.assertTrue('20' in warnings[0])
|
||||
|
||||
def testSystemHeaderOrderMismatch2(self):
|
||||
scope = [(10, '#include <cppsystem>'),
|
||||
(20, '#include "acustom.h"'),
|
||||
(30, '#include <csystem.h>')]
|
||||
all_linenums = [linenum for (linenum, _) in scope]
|
||||
mock_input_api = MockInputApi()
|
||||
warnings = PRESUBMIT._CheckIncludeOrderForScope(scope, mock_input_api,
|
||||
'', all_linenums)
|
||||
self.assertEqual(1, len(warnings))
|
||||
self.assertTrue('30' in warnings[0])
|
||||
|
||||
def testSystemHeaderOrderMismatch3(self):
|
||||
scope = [(10, '#include "acustom.h"'),
|
||||
(20, '#include <csystem.h>'),
|
||||
(30, '#include <cppsystem>')]
|
||||
all_linenums = [linenum for (linenum, _) in scope]
|
||||
mock_input_api = MockInputApi()
|
||||
warnings = PRESUBMIT._CheckIncludeOrderForScope(scope, mock_input_api,
|
||||
'', all_linenums)
|
||||
self.assertEqual(2, len(warnings))
|
||||
self.assertTrue('20' in warnings[0])
|
||||
self.assertTrue('30' in warnings[1])
|
||||
|
||||
def testAlphabeticalOrderMismatch(self):
|
||||
scope = [(10, '#include <csystem.h>'),
|
||||
(15, '#include <bsystem.h>'),
|
||||
(20, '#include <cppsystem>'),
|
||||
(25, '#include <bppsystem>'),
|
||||
(30, '#include "bcustom.h"'),
|
||||
(35, '#include "acustom.h"')]
|
||||
all_linenums = [linenum for (linenum, _) in scope]
|
||||
mock_input_api = MockInputApi()
|
||||
warnings = PRESUBMIT._CheckIncludeOrderForScope(scope, mock_input_api,
|
||||
'', all_linenums)
|
||||
self.assertEqual(3, len(warnings))
|
||||
self.assertTrue('15' in warnings[0])
|
||||
self.assertTrue('25' in warnings[1])
|
||||
self.assertTrue('35' in warnings[2])
|
||||
|
||||
def testSpecialFirstInclude1(self):
|
||||
mock_input_api = MockInputApi()
|
||||
contents = ['#include "some/path/foo.h"',
|
||||
'#include "a/header.h"']
|
||||
mock_file = MockFile('some/path/foo.cc', contents)
|
||||
warnings = PRESUBMIT._CheckIncludeOrderInFile(
|
||||
mock_input_api, mock_file, range(1, len(contents) + 1))
|
||||
self.assertEqual(0, len(warnings))
|
||||
|
||||
def testSpecialFirstInclude2(self):
|
||||
mock_input_api = MockInputApi()
|
||||
contents = ['#include "some/other/path/foo.h"',
|
||||
'#include "a/header.h"']
|
||||
mock_file = MockFile('some/path/foo.cc', contents)
|
||||
warnings = PRESUBMIT._CheckIncludeOrderInFile(
|
||||
mock_input_api, mock_file, range(1, len(contents) + 1))
|
||||
self.assertEqual(0, len(warnings))
|
||||
|
||||
def testSpecialFirstInclude3(self):
|
||||
mock_input_api = MockInputApi()
|
||||
contents = ['#include "some/path/foo.h"',
|
||||
'#include "a/header.h"']
|
||||
mock_file = MockFile('some/path/foo_platform.cc', contents)
|
||||
warnings = PRESUBMIT._CheckIncludeOrderInFile(
|
||||
mock_input_api, mock_file, range(1, len(contents) + 1))
|
||||
self.assertEqual(0, len(warnings))
|
||||
|
||||
def testSpecialFirstInclude4(self):
|
||||
mock_input_api = MockInputApi()
|
||||
contents = ['#include "some/path/bar.h"',
|
||||
'#include "a/header.h"']
|
||||
mock_file = MockFile('some/path/foo_platform.cc', contents)
|
||||
warnings = PRESUBMIT._CheckIncludeOrderInFile(
|
||||
mock_input_api, mock_file, range(1, len(contents) + 1))
|
||||
self.assertEqual(1, len(warnings))
|
||||
self.assertTrue('2' in warnings[0])
|
||||
|
||||
def testSpecialFirstInclude5(self):
|
||||
mock_input_api = MockInputApi()
|
||||
contents = ['#include "some/other/path/foo.h"',
|
||||
'#include "a/header.h"']
|
||||
mock_file = MockFile('some/path/foo-suffix.h', contents)
|
||||
warnings = PRESUBMIT._CheckIncludeOrderInFile(
|
||||
mock_input_api, mock_file, range(1, len(contents) + 1))
|
||||
self.assertEqual(0, len(warnings))
|
||||
|
||||
def testSpecialFirstInclude6(self):
|
||||
mock_input_api = MockInputApi()
|
||||
contents = ['#include "some/other/path/foo_win.h"',
|
||||
'#include <set>',
|
||||
'#include "a/header.h"']
|
||||
mock_file = MockFile('some/path/foo_unittest_win.h', contents)
|
||||
warnings = PRESUBMIT._CheckIncludeOrderInFile(
|
||||
mock_input_api, mock_file, range(1, len(contents) + 1))
|
||||
self.assertEqual(0, len(warnings))
|
||||
|
||||
def testOrderAlreadyWrong(self):
|
||||
scope = [(1, '#include "b.h"'),
|
||||
(2, '#include "a.h"'),
|
||||
(3, '#include "c.h"')]
|
||||
mock_input_api = MockInputApi()
|
||||
warnings = PRESUBMIT._CheckIncludeOrderForScope(scope, mock_input_api,
|
||||
'', [3])
|
||||
self.assertEqual(0, len(warnings))
|
||||
|
||||
def testConflictAdded1(self):
|
||||
scope = [(1, '#include "a.h"'),
|
||||
(2, '#include "c.h"'),
|
||||
(3, '#include "b.h"')]
|
||||
mock_input_api = MockInputApi()
|
||||
warnings = PRESUBMIT._CheckIncludeOrderForScope(scope, mock_input_api,
|
||||
'', [2])
|
||||
self.assertEqual(1, len(warnings))
|
||||
self.assertTrue('3' in warnings[0])
|
||||
|
||||
def testConflictAdded2(self):
|
||||
scope = [(1, '#include "c.h"'),
|
||||
(2, '#include "b.h"'),
|
||||
(3, '#include "d.h"')]
|
||||
mock_input_api = MockInputApi()
|
||||
warnings = PRESUBMIT._CheckIncludeOrderForScope(scope, mock_input_api,
|
||||
'', [2])
|
||||
self.assertEqual(1, len(warnings))
|
||||
self.assertTrue('2' in warnings[0])
|
||||
|
||||
def testIfElifElseEndif(self):
|
||||
mock_input_api = MockInputApi()
|
||||
contents = ['#include "e.h"',
|
||||
'#define foo',
|
||||
'#include "f.h"',
|
||||
'#undef foo',
|
||||
'#include "e.h"',
|
||||
'#if foo',
|
||||
'#include "d.h"',
|
||||
'#elif bar',
|
||||
'#include "c.h"',
|
||||
'#else',
|
||||
'#include "b.h"',
|
||||
'#endif',
|
||||
'#include "a.h"']
|
||||
mock_file = MockFile('', contents)
|
||||
warnings = PRESUBMIT._CheckIncludeOrderInFile(
|
||||
mock_input_api, mock_file, range(1, len(contents) + 1))
|
||||
self.assertEqual(0, len(warnings))
|
||||
|
||||
def testExcludedIncludes(self):
|
||||
# #include <sys/...>'s can appear in any order.
|
||||
mock_input_api = MockInputApi()
|
||||
contents = ['#include <sys/b.h>',
|
||||
'#include <sys/a.h>']
|
||||
mock_file = MockFile('', contents)
|
||||
warnings = PRESUBMIT._CheckIncludeOrderInFile(
|
||||
mock_input_api, mock_file, range(1, len(contents) + 1))
|
||||
self.assertEqual(0, len(warnings))
|
||||
|
||||
contents = ['#include <atlbase.h>',
|
||||
'#include <aaa.h>']
|
||||
mock_file = MockFile('', contents)
|
||||
warnings = PRESUBMIT._CheckIncludeOrderInFile(
|
||||
mock_input_api, mock_file, range(1, len(contents) + 1))
|
||||
self.assertEqual(0, len(warnings))
|
||||
|
||||
contents = ['#include "build/build_config.h"',
|
||||
'#include "aaa.h"']
|
||||
mock_file = MockFile('', contents)
|
||||
warnings = PRESUBMIT._CheckIncludeOrderInFile(
|
||||
mock_input_api, mock_file, range(1, len(contents) + 1))
|
||||
self.assertEqual(0, len(warnings))
|
||||
|
||||
def testCheckOnlyCFiles(self):
|
||||
mock_input_api = MockInputApi()
|
||||
mock_output_api = MockOutputApi()
|
||||
contents = ['#include <b.h>',
|
||||
'#include <a.h>']
|
||||
mock_file_cc = MockFile('something.cc', contents)
|
||||
mock_file_h = MockFile('something.h', contents)
|
||||
mock_file_other = MockFile('something.py', contents)
|
||||
mock_input_api.files = [mock_file_cc, mock_file_h, mock_file_other]
|
||||
warnings = PRESUBMIT._CheckIncludeOrder(mock_input_api, mock_output_api)
|
||||
self.assertEqual(1, len(warnings))
|
||||
self.assertEqual(2, len(warnings[0].items))
|
||||
self.assertEqual('promptOrNotify', warnings[0].type)
|
||||
|
||||
def testUncheckableIncludes(self):
|
||||
mock_input_api = MockInputApi()
|
||||
contents = ['#include <windows.h>',
|
||||
'#include "b.h"',
|
||||
'#include "a.h"']
|
||||
mock_file = MockFile('', contents)
|
||||
warnings = PRESUBMIT._CheckIncludeOrderInFile(
|
||||
mock_input_api, mock_file, range(1, len(contents) + 1))
|
||||
self.assertEqual(1, len(warnings))
|
||||
|
||||
contents = ['#include "gpu/command_buffer/gles_autogen.h"',
|
||||
'#include "b.h"',
|
||||
'#include "a.h"']
|
||||
mock_file = MockFile('', contents)
|
||||
warnings = PRESUBMIT._CheckIncludeOrderInFile(
|
||||
mock_input_api, mock_file, range(1, len(contents) + 1))
|
||||
self.assertEqual(1, len(warnings))
|
||||
|
||||
contents = ['#include "gl_mock_autogen.h"',
|
||||
'#include "b.h"',
|
||||
'#include "a.h"']
|
||||
mock_file = MockFile('', contents)
|
||||
warnings = PRESUBMIT._CheckIncludeOrderInFile(
|
||||
mock_input_api, mock_file, range(1, len(contents) + 1))
|
||||
self.assertEqual(1, len(warnings))
|
||||
|
||||
contents = ['#include "ipc/some_macros.h"',
|
||||
'#include "b.h"',
|
||||
'#include "a.h"']
|
||||
mock_file = MockFile('', contents)
|
||||
warnings = PRESUBMIT._CheckIncludeOrderInFile(
|
||||
mock_input_api, mock_file, range(1, len(contents) + 1))
|
||||
self.assertEqual(1, len(warnings))
|
||||
|
||||
|
||||
class VersionControlConflictsTest(unittest.TestCase):
|
||||
def testTypicalConflict(self):
|
||||
lines = ['<<<<<<< HEAD',
|
||||
' base::ScopedTempDir temp_dir_;',
|
||||
'=======',
|
||||
' ScopedTempDir temp_dir_;',
|
||||
'>>>>>>> master']
|
||||
errors = PRESUBMIT._CheckForVersionControlConflictsInFile(
|
||||
MockInputApi(), MockFile('some/path/foo_platform.cc', lines))
|
||||
self.assertEqual(3, len(errors))
|
||||
self.assertTrue('1' in errors[0])
|
||||
self.assertTrue('3' in errors[1])
|
||||
self.assertTrue('5' in errors[2])
|
||||
|
||||
|
||||
class BadExtensionsTest(unittest.TestCase):
|
||||
def testBadRejFile(self):
|
||||
mock_input_api = MockInputApi()
|
||||
mock_input_api.files = [
|
||||
MockFile('some/path/foo.cc', ''),
|
||||
MockFile('some/path/foo.cc.rej', ''),
|
||||
MockFile('some/path2/bar.h.rej', ''),
|
||||
]
|
||||
|
||||
results = PRESUBMIT._CheckPatchFiles(mock_input_api, MockOutputApi())
|
||||
self.assertEqual(1, len(results))
|
||||
self.assertEqual(2, len(results[0].items))
|
||||
self.assertTrue('foo.cc.rej' in results[0].items[0])
|
||||
self.assertTrue('bar.h.rej' in results[0].items[1])
|
||||
|
||||
def testBadOrigFile(self):
|
||||
mock_input_api = MockInputApi()
|
||||
mock_input_api.files = [
|
||||
MockFile('other/path/qux.h.orig', ''),
|
||||
MockFile('other/path/qux.h', ''),
|
||||
MockFile('other/path/qux.cc', ''),
|
||||
]
|
||||
|
||||
results = PRESUBMIT._CheckPatchFiles(mock_input_api, MockOutputApi())
|
||||
self.assertEqual(1, len(results))
|
||||
self.assertEqual(1, len(results[0].items))
|
||||
self.assertTrue('qux.h.orig' in results[0].items[0])
|
||||
|
||||
def testGoodFiles(self):
|
||||
mock_input_api = MockInputApi()
|
||||
mock_input_api.files = [
|
||||
MockFile('other/path/qux.h', ''),
|
||||
MockFile('other/path/qux.cc', ''),
|
||||
]
|
||||
results = PRESUBMIT._CheckPatchFiles(mock_input_api, MockOutputApi())
|
||||
self.assertEqual(0, len(results))
|
||||
|
||||
def testNoFiles(self):
|
||||
mock_change = MockChange([])
|
||||
results = PRESUBMIT.GetPreferredTryMasters(None, mock_change)
|
||||
self.assertEqual({}, results)
|
||||
|
||||
|
||||
class InvalidOSMacroNamesTest(unittest.TestCase):
|
||||
def testInvalidOSMacroNames(self):
|
||||
lines = ['#if defined(OS_WINDOWS)',
|
||||
' #elif defined(OS_WINDOW)',
|
||||
' # if defined(OS_MACOSX) || defined(OS_CHROME)',
|
||||
'# else // defined(OS_MAC)',
|
||||
'#endif // defined(OS_MACOS)']
|
||||
errors = PRESUBMIT._CheckForInvalidOSMacrosInFile(
|
||||
MockInputApi(), MockFile('some/path/foo_platform.cc', lines))
|
||||
self.assertEqual(len(lines), len(errors))
|
||||
self.assertTrue(':1 OS_WINDOWS' in errors[0])
|
||||
self.assertTrue('(did you mean OS_WIN?)' in errors[0])
|
||||
|
||||
def testValidOSMacroNames(self):
|
||||
lines = ['#if defined(%s)' % m for m in PRESUBMIT._VALID_OS_MACROS]
|
||||
errors = PRESUBMIT._CheckForInvalidOSMacrosInFile(
|
||||
MockInputApi(), MockFile('some/path/foo_platform.cc', lines))
|
||||
self.assertEqual(0, len(errors))
|
||||
|
||||
|
||||
class InvalidIfDefinedMacroNamesTest(unittest.TestCase):
|
||||
def testInvalidIfDefinedMacroNames(self):
|
||||
lines = ['#if defined(TARGET_IPHONE_SIMULATOR)',
|
||||
'#if !defined(TARGET_IPHONE_SIMULATOR)',
|
||||
'#elif defined(TARGET_IPHONE_SIMULATOR)',
|
||||
'#ifdef TARGET_IPHONE_SIMULATOR',
|
||||
' # ifdef TARGET_IPHONE_SIMULATOR',
|
||||
'# if defined(VALID) || defined(TARGET_IPHONE_SIMULATOR)',
|
||||
'# else // defined(TARGET_IPHONE_SIMULATOR)',
|
||||
'#endif // defined(TARGET_IPHONE_SIMULATOR)',]
|
||||
errors = PRESUBMIT._CheckForInvalidIfDefinedMacrosInFile(
|
||||
MockInputApi(), MockFile('some/path/source.mm', lines))
|
||||
self.assertEqual(len(lines), len(errors))
|
||||
|
||||
def testValidIfDefinedMacroNames(self):
|
||||
lines = ['#if defined(FOO)',
|
||||
'#ifdef BAR',]
|
||||
errors = PRESUBMIT._CheckForInvalidIfDefinedMacrosInFile(
|
||||
MockInputApi(), MockFile('some/path/source.cc', lines))
|
||||
self.assertEqual(0, len(errors))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
109
engine/src/flutter/PRESUBMIT_test_mocks.py
Normal file
109
engine/src/flutter/PRESUBMIT_test_mocks.py
Normal file
@@ -0,0 +1,109 @@
|
||||
# Copyright 2014 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 json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
class MockInputApi(object):
|
||||
"""Mock class for the InputApi class.
|
||||
|
||||
This class can be used for unittests for presubmit by initializing the files
|
||||
attribute as the list of changed files.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.json = json
|
||||
self.re = re
|
||||
self.os_path = os.path
|
||||
self.python_executable = sys.executable
|
||||
self.subprocess = subprocess
|
||||
self.files = []
|
||||
self.is_committing = False
|
||||
|
||||
def AffectedFiles(self, file_filter=None):
|
||||
return self.files
|
||||
|
||||
def PresubmitLocalPath(self):
|
||||
return os.path.dirname(__file__)
|
||||
|
||||
def ReadFile(self, filename, mode='rU'):
|
||||
for file_ in self.files:
|
||||
if file_.LocalPath() == filename:
|
||||
return '\n'.join(file_.NewContents())
|
||||
# Otherwise, file is not in our mock API.
|
||||
raise IOError, "No such file or directory: '%s'" % filename
|
||||
|
||||
|
||||
class MockOutputApi(object):
|
||||
"""Mock class for the OutputApi class.
|
||||
|
||||
An instance of this class can be passed to presubmit unittests for outputing
|
||||
various types of results.
|
||||
"""
|
||||
|
||||
class PresubmitResult(object):
|
||||
def __init__(self, message, items=None, long_text=''):
|
||||
self.message = message
|
||||
self.items = items
|
||||
self.long_text = long_text
|
||||
|
||||
class PresubmitError(PresubmitResult):
|
||||
def __init__(self, message, items, long_text=''):
|
||||
MockOutputApi.PresubmitResult.__init__(self, message, items, long_text)
|
||||
self.type = 'error'
|
||||
|
||||
class PresubmitPromptWarning(PresubmitResult):
|
||||
def __init__(self, message, items, long_text=''):
|
||||
MockOutputApi.PresubmitResult.__init__(self, message, items, long_text)
|
||||
self.type = 'warning'
|
||||
|
||||
class PresubmitNotifyResult(PresubmitResult):
|
||||
def __init__(self, message, items, long_text=''):
|
||||
MockOutputApi.PresubmitResult.__init__(self, message, items, long_text)
|
||||
self.type = 'notify'
|
||||
|
||||
class PresubmitPromptOrNotify(PresubmitResult):
|
||||
def __init__(self, message, items, long_text=''):
|
||||
MockOutputApi.PresubmitResult.__init__(self, message, items, long_text)
|
||||
self.type = 'promptOrNotify'
|
||||
|
||||
|
||||
class MockFile(object):
|
||||
"""Mock class for the File class.
|
||||
|
||||
This class can be used to form the mock list of changed files in
|
||||
MockInputApi for presubmit unittests.
|
||||
"""
|
||||
|
||||
def __init__(self, local_path, new_contents):
|
||||
self._local_path = local_path
|
||||
self._new_contents = new_contents
|
||||
self._changed_contents = [(i + 1, l) for i, l in enumerate(new_contents)]
|
||||
|
||||
def ChangedContents(self):
|
||||
return self._changed_contents
|
||||
|
||||
def NewContents(self):
|
||||
return self._new_contents
|
||||
|
||||
def LocalPath(self):
|
||||
return self._local_path
|
||||
|
||||
|
||||
class MockChange(object):
|
||||
"""Mock class for Change class.
|
||||
|
||||
This class can be used in presubmit unittests to mock the query of the
|
||||
current change.
|
||||
"""
|
||||
|
||||
def __init__(self, changed_files):
|
||||
self._changed_files = changed_files
|
||||
|
||||
def LocalPaths(self):
|
||||
return self._changed_files
|
||||
45
engine/src/flutter/WATCHLISTS
Normal file
45
engine/src/flutter/WATCHLISTS
Normal file
@@ -0,0 +1,45 @@
|
||||
# Copyright 2014 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.
|
||||
|
||||
# Watchlist Rules
|
||||
# Refer: http://dev.chromium.org/developers/contributing-code/watchlists
|
||||
|
||||
# IMPORTANT: The regular expression filepath is tested against each path using
|
||||
# re.search, so it is not usually necessary to add .*.
|
||||
|
||||
{
|
||||
'WATCHLIST_DEFINITIONS': {
|
||||
'mojo': {
|
||||
'filepath': 'mojo',
|
||||
},
|
||||
'services': {
|
||||
'filepath': 'services',
|
||||
},
|
||||
'shell': {
|
||||
'filepath': 'shell',
|
||||
},
|
||||
'sky': {
|
||||
'filepath': 'sky',
|
||||
},
|
||||
},
|
||||
|
||||
'WATCHLISTS': {
|
||||
'mojo': ['aa@chromium.org',
|
||||
'abarth@chromium.org',
|
||||
'ben+mojo@chromium.org',
|
||||
'darin@chromium.org',
|
||||
'qsr+mojo@chromium.org',
|
||||
'viettrungluu+watch@chromium.org',
|
||||
'gregsimon@chromium.org',
|
||||
'yzshen+watch@chromium.org'],
|
||||
'services': ['qsr+mojo@chromium.org',
|
||||
'yzshen+watch@chromium.org'],
|
||||
'shell': ['qsr+mojo@chromium.org',
|
||||
'yzshen+watch@chromium.org'],
|
||||
'sky': ['abarth@chromium.org',
|
||||
'gregsimon@chromium.org',
|
||||
'jackson@chromium.org',
|
||||
'qsr+mojo@chromium.org'],
|
||||
},
|
||||
}
|
||||
6
engine/src/flutter/codereview.settings
Normal file
6
engine/src/flutter/codereview.settings
Normal file
@@ -0,0 +1,6 @@
|
||||
# This file is used by gcl to get repository specific information.
|
||||
CODE_REVIEW_SERVER: codereview.chromium.org
|
||||
CC_LIST: mojo-reviews@chromium.org
|
||||
VIEW_VC: https://chromium.googlesource.com/external/mojo/+/
|
||||
PROJECT: mojo
|
||||
RUN_POST_UPLOAD_HOOK: True
|
||||
43
engine/src/flutter/third_party/BUILD.gn
vendored
Normal file
43
engine/src/flutter/third_party/BUILD.gn
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# Copyright 2014 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.
|
||||
|
||||
if (is_android) {
|
||||
import("//build/config/android/config.gni")
|
||||
}
|
||||
|
||||
declare_args() {
|
||||
# Uses system libjpeg. If true, overrides use_libjpeg_turbo.
|
||||
use_system_libjpeg = false
|
||||
|
||||
# Uses libjpeg_turbo as the jpeg implementation. Has no effect if
|
||||
# use_system_libjpeg is set.
|
||||
use_libjpeg_turbo = true
|
||||
}
|
||||
|
||||
config("system_libjpeg_config") {
|
||||
defines = [ "USE_SYSTEM_LIBJPEG" ]
|
||||
}
|
||||
|
||||
config("libjpeg_turbo_config") {
|
||||
defines = [ "USE_LIBJPEG_TURBO" ]
|
||||
}
|
||||
|
||||
# This is a meta target that forwards to the system's libjpeg,
|
||||
# third_party/libjpeg, or third_party/libjpeg_turbo depending on the build args
|
||||
# declared in this file.
|
||||
group("jpeg") {
|
||||
if (use_system_libjpeg) {
|
||||
libs = [ "jpeg" ]
|
||||
public_configs = [ ":system_libjpeg_config" ]
|
||||
} else if (use_libjpeg_turbo) {
|
||||
deps = [
|
||||
"//third_party/libjpeg_turbo:libjpeg",
|
||||
]
|
||||
public_configs = [ ":libjpeg_turbo_config" ]
|
||||
} else {
|
||||
deps = [
|
||||
"//third_party/libjpeg:libjpeg",
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user