1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "xwalk/extensions/test/xwalk_extensions_test_base.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/path_service.h"
10 #include "base/strings/utf_string_conversions.h"
11 #include "net/base/filename_util.h"
12 #include "xwalk/extensions/browser/xwalk_extension_service.h"
13 #include "xwalk/extensions/common/xwalk_extension.h"
14 #include "xwalk/test/base/xwalk_test_utils.h"
15 #include "content/public/test/browser_test_utils.h"
16 #include "content/public/test/test_utils.h"
17 #include "net/base/net_util.h"
19 using xwalk::extensions::XWalkExtensionVector;
20 using xwalk::extensions::XWalkExtensionService;
22 void XWalkExtensionsTestBase::SetUp() {
23 XWalkExtensionService::SetCreateUIThreadExtensionsCallbackForTesting(
24 base::Bind(&XWalkExtensionsTestBase::CreateExtensionsForUIThread,
25 base::Unretained(this)));
26 XWalkExtensionService::SetCreateExtensionThreadExtensionsCallbackForTesting(
27 base::Bind(&XWalkExtensionsTestBase::CreateExtensionsForExtensionThread,
28 base::Unretained(this)));
29 InProcessBrowserTest::SetUp();
32 void XWalkExtensionsTestBase::CreateExtensionsForUIThread(
33 XWalkExtensionVector* extensions) {}
35 void XWalkExtensionsTestBase::CreateExtensionsForExtensionThread(
36 XWalkExtensionVector* extensions) {}
38 GURL GetExtensionsTestURL(const base::FilePath& dir,
39 const base::FilePath& file) {
40 base::FilePath test_file;
41 PathService::Get(base::DIR_SOURCE_ROOT, &test_file);
43 .Append(FILE_PATH_LITERAL("xwalk"))
44 .Append(FILE_PATH_LITERAL("extensions"))
45 .Append(FILE_PATH_LITERAL("test"))
46 .Append(FILE_PATH_LITERAL("data"))
47 .Append(dir).Append(file);
48 return net::FilePathToFileURL(test_file);
51 base::FilePath GetExternalExtensionTestPath(
52 const base::FilePath::CharType test[]) {
53 base::FilePath extension_dir;
54 PathService::Get(base::DIR_EXE, &extension_dir);
55 extension_dir = extension_dir
56 .Append(FILE_PATH_LITERAL("tests"))
57 .Append(FILE_PATH_LITERAL("extension"))