%endif
Name: crosswalk
-Version: 9.38.204.0
+Version: 9.38.205.0
Release: 0
Summary: Chromium-based app runtime
License: (BSD-3-Clause and LGPL-2.1+)
MAJOR=9
MINOR=38
-BUILD=204
+BUILD=205
PATCH=0
private boolean mRemoteDebugging = false;
+ private boolean mUseAnimatableView = false;
+
private AlertDialog mLibraryNotFoundDialog = null;
private XWalkRuntimeExtensionManager mExtensionManager;
@Override
public void onNewIntent(Intent intent) {
if (mRuntimeView == null || !mRuntimeView.onNewIntent(intent)) super.onNewIntent(intent);
+ if (mExtensionManager != null) mExtensionManager.onNewIntent(intent);
}
@Override
private void tryLoadRuntimeView() {
try {
+ if (mUseAnimatableView) {
+ XWalkPreferences.setValue(XWalkPreferences.ANIMATABLE_XWALK_VIEW, true);
+ } else {
+ XWalkPreferences.setValue(XWalkPreferences.ANIMATABLE_XWALK_VIEW, false);
+ }
mRuntimeView = new XWalkRuntimeView(this, this, null);
mShownNotFoundDialog = false;
if (mLibraryNotFoundDialog != null) mLibraryNotFoundDialog.cancel();
mRemoteDebugging = value;
}
+ public void setUseAnimatableView(boolean value) {
+ mUseAnimatableView = value;
+ }
+
}
mExtension.onStop();
}
+ public void onNewIntent(Intent intent) {
+ mExtension.onNewIntent(intent);
+ }
+
public void onActivityResult(int requestCode, int resultCode, Intent data) {
mExtension.onActivityResult(requestCode, resultCode, data);
}
}
/**
+ * Called when this app is onNewIntent.
+ */
+ public void onNewIntent(Intent intent) {
+ }
+
+ /**
* Tell extension that one activity exists so that it can know the result
* of the exit code.
*/
public void onDestroy();
/**
+ * Called when the extension's activity is required to be invoked but
+ * without creating a new activity instance.
+ */
+ public void onNewIntent(Intent intent);
+
+ /**
* Called when the extension exists if activity launched exists.
* TODO(hmin): Figure out if it is necessary and how to use it.
*/
mExtensions.clear();
}
+ public void onNewIntent(Intent intent) {
+ for(XWalkRuntimeExtensionBridge extension: mExtensions.values()) {
+ extension.onNewIntent(intent);
+ }
+ }
+
public void onActivityResult(int requestCode, int resultCode, Intent data) {
for(XWalkRuntimeExtensionBridge extension: mExtensions.values()) {
extension.onActivityResult(requestCode, resultCode, data);
self.app_name = ''
self.package = 'org.xwalk.app.template'
self.remote_debugging = ''
+ self.use_animatable_view = ''
SetVariable(dest_activity,
'public void onCreate(Bundle savedInstanceState)',
'RemoteDebugging', 'true')
+ if app_info.use_animatable_view:
+ SetVariable(dest_activity,
+ 'public void onCreate(Bundle savedInstanceState)',
+ 'UseAnimatableView', 'true')
if app_info.fullscreen_flag:
SetVariable(dest_activity,
'super.onCreate(savedInstanceState)',
parser.add_option('--enable-remote-debugging', action='store_true',
dest='enable_remote_debugging', default=False,
help='Enable remote debugging.')
+ parser.add_option('--use-animatable-view', action='store_true',
+ dest='use_animatable_view', default=False,
+ help='Enable using animatable view (TextureView).')
parser.add_option('-f', '--fullscreen', action='store_true',
dest='fullscreen', default=False,
help='Make application fullscreen.')
app_info.app_root = os.path.expanduser(options.app_root)
if options.enable_remote_debugging:
app_info.remote_debugging = '--enable-remote-debugging'
+ if options.use_animatable_view:
+ app_info.use_animatable_view = '--use-animatable-view'
if options.fullscreen:
app_info.fullscreen_flag = '-f'
if options.orientation:
group.add_option('--enable-remote-debugging', action='store_true',
dest='enable_remote_debugging', default=False,
help='Enable remote debugging.')
+ group.add_option('--use-animatable-view', action='store_true',
+ dest='use_animatable_view', default=False,
+ help='Enable using animatable view (TextureView).')
info = ('The list of external extension paths splitted by OS separators. '
'The separators are \':\' , \';\' and \':\' on Linux, Windows and '
'Mac OS respectively. For example, '
self.assertTrue(content.find('setRemoteDebugging') != -1)
self.checkApks('Example', '1.0.0')
+ def testUseAnimatableView(self):
+ cmd = ['python', 'make_apk.py', '--name=Example', '--app-version=1.0.0',
+ '--package=org.xwalk.example', '--app-url=http://www.intel.com',
+ '--use-animatable-view', self._mode]
+ RunCommand(cmd)
+ self.addCleanup(Clean, 'Example', '1.0.0')
+ activity = 'Example/src/org/xwalk/example/ExampleActivity.java'
+ with open(activity, 'r') as content_file:
+ content = content_file.read()
+ self.assertTrue(os.path.exists(activity))
+ self.assertTrue(content.find('setUseAnimatableView') != -1)
+ self.checkApks('Example', '1.0.0')
+ Clean('Example', '1.0.0')
+ manifest_path = os.path.join('test_data', 'manifest', 'manifest.json')
+ cmd = ['python', 'make_apk.py', '--use-animatable-view',
+ '--package=org.xwalk.example',
+ '--manifest=%s' % manifest_path, self._mode]
+ RunCommand(cmd)
+ activity = 'Example/src/org/xwalk/example/ExampleActivity.java'
+ with open(activity, 'r') as content_file:
+ content = content_file.read()
+ self.assertTrue(os.path.exists(activity))
+ self.assertTrue(content.find('setUseAnimatableView') != -1)
+ self.checkApks('Example', '1.0.0')
+
def testKeystore(self):
keystore_path = os.path.join('test_data', 'keystore',
'xwalk-test.keystore')
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/site_instance.h"
#include "net/base/net_util.h"
-#include "xwalk/application/browser/application_service.h"
-#include "xwalk/application/browser/application_system.h"
-#include "xwalk/application/common/application_storage.h"
#include "xwalk/application/common/application_manifest_constants.h"
#include "xwalk/application/common/constants.h"
#include "xwalk/application/common/manifest_handlers/warp_handler.h"
#include <vector>
#include "xwalk/application/browser/application.h"
-#include "xwalk/application/common/application_storage.h"
#include "xwalk/application/common/id_util.h"
+#include "xwalk/application/common/tizen/application_storage.h"
#include "xwalk/runtime/browser/runtime_context.h"
namespace xwalk {
+++ /dev/null
-// Copyright (c) 2013 Intel Corporation. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "xwalk/application/common/application_storage_constants.h"
-#include "base/strings/stringprintf.h"
-
-namespace xwalk {
-namespace application_storage_constants {
-
-const char kAppTableName[] = "applications";
-const char kPermissionTableName[] = "stored_permissions";
-const char kGarbageCollectionTableName[] = "garbage_collection";
-
-const char kCreateAppTableOp[] =
- "CREATE TABLE applications ("
- "id TEXT NOT NULL UNIQUE PRIMARY KEY,"
- "manifest TEXT NOT NULL,"
- "path TEXT NOT NULL,"
- "install_time REAL)";
-
-const char kCreatePermissionTableOp[] =
- "CREATE TABLE stored_permissions ("
- "id TEXT NOT NULL,"
- "permission_names TEXT NOT NULL,"
- "PRIMARY KEY (id),"
- "FOREIGN KEY (id) REFERENCES applications(id)"
- "ON DELETE CASCADE)";
-
-const char kGetRowFromAppTableOp[] =
- "SELECT A.id, A.manifest, A.path, A.install_time, "
- "C.permission_names FROM applications as A "
- "LEFT JOIN stored_permissions as C "
- "ON A.id = C.id WHERE A.id = ?";
-
-const char kGetAllRowsFromAppTableOp[] =
- "SELECT A.id, A.manifest, A.path, A.install_time, "
- "C.permission_names FROM applications as A "
- "LEFT JOIN stored_permissions as C "
- "ON A.id = C.id";
-
-extern const char kGetAllIDsFromAppTableOp[] =
- "SELECT id FROM applications";
-
-const char kSetApplicationWithBindOp[] =
- "INSERT INTO applications (manifest, path, install_time, id) "
- "VALUES (?,?,?,?)";
-
-const char kUpdateApplicationWithBindOp[] =
- "UPDATE applications SET manifest = ?, path = ?,"
- "install_time = ? WHERE id = ?";
-
-const char kDeleteApplicationWithBindOp[] =
- "DELETE FROM applications WHERE id = ?";
-
-const char kInsertPermissionsWithBindOp[] =
- "INSERT INTO stored_permissions (permission_names, id) "
- "VALUES(?,?)";
-
-const char kUpdatePermissionsWithBindOp[] =
- "UPDATE stored_permissions SET permission_names = ? WHERE id = ?";
-
-const char kDeletePermissionsWithBindOp[] =
- "DELETE FROM stored_permissions WHERE id = ?";
-
-} // namespace application_storage_constants
-} // namespace xwalk
+++ /dev/null
-// Copyright (c) 2013 Intel Corporation. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef XWALK_APPLICATION_COMMON_APPLICATION_STORAGE_CONSTANTS_H_
-#define XWALK_APPLICATION_COMMON_APPLICATION_STORAGE_CONSTANTS_H_
-
-#include "base/files/file_path.h"
-#include "base/basictypes.h"
-
-namespace xwalk {
-namespace application_storage_constants {
- extern const char kAppTableName[];
- extern const char kPermissionTableName[];
- extern const char kGarbageCollectionTableName[];
-
- extern const char kCreateAppTableOp[];
- extern const char kCreatePermissionTableOp[];
- extern const char kGetRowFromAppTableOp[];
- extern const char kGetAllRowsFromAppTableOp[];
- extern const char kGetAllIDsFromAppTableOp[];
- extern const char kSetApplicationWithBindOp[];
- extern const char kUpdateApplicationWithBindOp[];
- extern const char kDeleteApplicationWithBindOp[];
- extern const char kInsertPermissionsWithBindOp[];
- extern const char kUpdatePermissionsWithBindOp[];
- extern const char kDeletePermissionsWithBindOp[];
-
-} // namespace application_storage_constants
-} // namespace xwalk
-
-#endif // XWALK_APPLICATION_COMMON_APPLICATION_STORAGE_CONSTANTS_H_
+++ /dev/null
-// Copyright (c) 2013 Intel Corporation. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "xwalk/application/common/application_storage_impl.h"
-
-#include <string>
-#include <vector>
-
-#include "base/file_util.h"
-#include "base/strings/stringprintf.h"
-#include "base/strings/string_split.h"
-#include "base/strings/string_util.h"
-#include "base/json/json_file_value_serializer.h"
-#include "base/json/json_string_value_serializer.h"
-#include "sql/statement.h"
-#include "sql/transaction.h"
-#include "xwalk/application/common/application_storage.h"
-#include "xwalk/application/common/application_storage_constants.h"
-#include "xwalk/application/common/id_util.h"
-
-namespace db_fields = xwalk::application_storage_constants;
-namespace xwalk {
-namespace application {
-
-const base::FilePath::CharType ApplicationStorageImpl::kDBFileName[] =
- FILE_PATH_LITERAL("applications.db");
-
-const char kPermissionSeparator = '^';
-
-// Switching the JSON format DB(version 0) to SQLite backend version 1,
-// should migrate all data from JSON DB to SQLite applications table.
-static const int kVersionNumber = 1;
-
-namespace {
-
-const std::string StoredPermissionStr[] = {
- "ALLOW",
- "DENY",
- "PROMPT",
-};
-
-std::string ToString(StoredPermission permission) {
- if (permission == UNDEFINED_STORED_PERM)
- return std::string("");
- return StoredPermissionStr[permission];
-}
-
-StoredPermission ToPermission(const std::string& str) {
- unsigned int i;
- for (i = 0; i < UNDEFINED_STORED_PERM; ++i) {
- if (str == StoredPermissionStr[i])
- break;
- }
- return static_cast<StoredPermission>(i);
-}
-
-inline const base::FilePath GetDBPath(const base::FilePath& path) {
- return path.Append(ApplicationStorageImpl::kDBFileName);
-}
-
-// Initializes the applications table, returning true on success.
-bool InitApplicationsTable(sql::Connection* db) {
- sql::Transaction transaction(db);
- transaction.Begin();
- // The table is named "applications", the primary key is "id".
- if (!db->DoesTableExist(db_fields::kAppTableName)) {
- if (!db->Execute(db_fields::kCreateAppTableOp))
- return false;
- }
- return transaction.Commit();
-}
-
-// Permissions are stored like "bluetooth^ALLOW;calendar^DENY;contacts^ALLOW"
-std::string ToString(StoredPermissionMap permissions) {
- std::string str;
- StoredPermissionMap::iterator iter;
- for (iter = permissions.begin(); iter != permissions.end(); ++iter) {
- if (!str.empty())
- str += ";";
- str += (iter->first + kPermissionSeparator + ToString(iter->second));
- }
- return str;
-}
-
-StoredPermissionMap ToPermissionMap(const std::string& str) {
- StoredPermissionMap map;
- std::vector<std::string> vec;
- base::SplitString(str, ';', &vec);
- if (!vec.empty()) {
- for (std::vector<std::string>::iterator iter = vec.begin();
- iter != vec.end(); ++iter) {
- std::vector<std::string> perm_item;
- base::SplitString(*iter, kPermissionSeparator, &perm_item);
- if (perm_item.size() != 2) {
- LOG(ERROR) << "Permission format error! Corrupted database?";
- map.clear();
- break;
- }
- map[perm_item[0]] = ToPermission(perm_item[1]);
- }
- }
- return map;
-}
-
-bool InitPermissionsTable(sql::Connection* db) {
- sql::Transaction transaction(db);
- transaction.Begin();
- if (!db->DoesTableExist(db_fields::kPermissionTableName)) {
- if (!db->Execute(db_fields::kCreatePermissionTableOp))
- return false;
- }
- return transaction.Commit();
-}
-
-} // namespace
-
-ApplicationStorageImpl::ApplicationStorageImpl(const base::FilePath& path)
- : data_path_(path),
- db_initialized_(false) {
- // Ensure the parent directory for database file is created before reading
- // from it.
- if (!base::PathExists(path) && !base::CreateDirectory(path))
- return;
-}
-
-bool ApplicationStorageImpl::UpgradeToVersion1(const base::FilePath& v0_file) {
- JSONFileValueSerializer serializer(v0_file);
- int error_code;
- std::string error;
- base::Value* old_db = serializer.Deserialize(&error_code, &error);
- if (!old_db) {
- LOG(ERROR) << "Unable to read applications information from JSON DB, "
- "the error message is: "
- << error;
- return false;
- }
-
- scoped_ptr<base::DictionaryValue> value;
- for (base::DictionaryValue::Iterator it(
- *static_cast<base::DictionaryValue*>(old_db));
- !it.IsAtEnd(); it.Advance()) {
- value.reset(static_cast<base::DictionaryValue*>(it.value().DeepCopy()));
- base::DictionaryValue* manifest;
- value->GetDictionary("manifest", &manifest);
- std::string path;
- value->GetString("path", &path);
- std::string error;
- scoped_refptr<ApplicationData> application =
- ApplicationData::Create(base::FilePath::FromUTF8Unsafe(path),
- ApplicationData::INTERNAL,
- *manifest,
- it.key(),
- &error);
- if (!application) {
- LOG(ERROR) << "Unable to migrate the information to Version 1: " << error;
- return false;
- }
-
- double install_time;
- value->GetDouble("install_time", &install_time);
- if (!AddApplication(application, base::Time::FromDoubleT(install_time)))
- return false;
- }
- meta_table_.SetVersionNumber(1);
-
- return true;
-}
-
-ApplicationStorageImpl::~ApplicationStorageImpl() {
-}
-
-bool ApplicationStorageImpl::Init() {
- bool does_db_exist = base::PathExists(GetDBPath(data_path_));
- scoped_ptr<sql::Connection> sqlite_db(new sql::Connection);
- if (!sqlite_db->Open(GetDBPath(data_path_))) {
- LOG(ERROR) << "Unable to open applications DB.";
- return false;
- }
- sqlite_db->Preload();
-
- if (!meta_table_.Init(sqlite_db.get(), kVersionNumber, kVersionNumber) ||
- meta_table_.GetVersionNumber() != kVersionNumber) {
- LOG(ERROR) << "Unable to init the META table.";
- return false;
- }
-
- if (!InitApplicationsTable(sqlite_db.get())) {
- LOG(ERROR) << "Unable to open applications table.";
- return false;
- }
-
- if (!InitPermissionsTable(sqlite_db.get())) {
- LOG(ERROR) << "Unable to open registered permissions table.";
- return false;
- }
-
- if (!sqlite_db->Execute("PRAGMA foreign_keys=ON")) {
- LOG(ERROR) << "Unable to enforce foreign key contraints.";
- return false;
- }
-
- sqlite_db_.reset(sqlite_db.release());
-
- db_initialized_ = (sqlite_db_ && sqlite_db_->is_open());
-
- base::FilePath v0_file = data_path_.Append(
- FILE_PATH_LITERAL("applications_db"));
- if (base::PathExists(v0_file) &&
- !does_db_exist) {
- if (!UpgradeToVersion1(v0_file)) {
- LOG(ERROR) << "Unable to migrate database from JSON format to SQLite.";
- return false;
- }
- // After migrated to SQLite, delete the old JSON DB file is safe,
- // since all information has been migrated and it will not be used anymore.
- if (!base::DeleteFile(v0_file, false)) {
- LOG(ERROR) << "Unalbe to delete old JSON DB file.";
- return false;
- }
- }
-
- db_initialized_ = true;
-
- return db_initialized_;
-}
-
-scoped_refptr<ApplicationData> ApplicationStorageImpl::ExtractApplicationData(
- const sql::Statement& smt) {
- std::string id = smt.ColumnString(0);
-
- int error_code;
- std::string manifest_str = smt.ColumnString(1);
- JSONStringValueSerializer serializer(&manifest_str);
- std::string error_msg;
- scoped_ptr<base::DictionaryValue> manifest(
- static_cast<base::DictionaryValue*>(
- serializer.Deserialize(&error_code, &error_msg)));
-
- if (!manifest) {
- LOG(ERROR) << "An error occured when deserializing the manifest, "
- "the error message is: "
- << error_msg;
- return NULL;
- }
- std::string path = smt.ColumnString(2);
- double install_time = smt.ColumnDouble(3);
-
- std::string error;
- scoped_refptr<ApplicationData> app_data =
- ApplicationData::Create(
- base::FilePath::FromUTF8Unsafe(path),
- ApplicationData::INTERNAL,
- *manifest,
- id,
- &error);
- if (!app_data) {
- LOG(ERROR) << "Load appliation error: " << error;
- return NULL;
- }
-
- app_data->install_time_ = base::Time::FromDoubleT(install_time);
-
- app_data->permission_map_ = ToPermissionMap(smt.ColumnString(4));
-
- return app_data;
-}
-
-scoped_refptr<ApplicationData> ApplicationStorageImpl::GetApplicationData(
- const std::string& app_id) {
- if (!db_initialized_) {
- LOG(ERROR) << "The database hasn't been initilized.";
- return NULL;
- }
-
- sql::Statement smt(sqlite_db_->GetUniqueStatement(
- db_fields::kGetRowFromAppTableOp));
- smt.BindString(0, app_id);
- if (!smt.is_valid())
- return NULL;
-
- if (!smt.Step())
- return NULL;
-
- return ExtractApplicationData(smt);
-}
-
-bool ApplicationStorageImpl::GetInstalledApplications(
- ApplicationData::ApplicationDataMap& applications) { // NOLINT
- if (!db_initialized_) {
- LOG(ERROR) << "The database hasn't been initilized.";
- return false;
- }
-
- sql::Statement smt(sqlite_db_->GetUniqueStatement(
- db_fields::kGetAllRowsFromAppTableOp));
- if (!smt.is_valid())
- return false;
-
- while (smt.Step()) {
- scoped_refptr<ApplicationData> data = ExtractApplicationData(smt);
- if (!data) {
- LOG(ERROR) << "Failed to obtain ApplicationData from SQL query";
- return false;
- }
- applications.insert(
- std::pair<std::string, scoped_refptr<ApplicationData> >(
- data->ID(), data));
- }
-
- return true;
-}
-
-bool ApplicationStorageImpl::GetInstalledApplicationIDs(
- std::vector<std::string>& app_ids) { // NOLINT
- if (!db_initialized_) {
- LOG(ERROR) << "The database hasn't been initilized.";
- return false;
- }
-
- sql::Statement smt(sqlite_db_->GetUniqueStatement(
- db_fields::kGetAllIDsFromAppTableOp));
- if (!smt.is_valid())
- return false;
-
- while (smt.Step()) {
- const std::string& id = smt.ColumnString(0);
- if (!IsValidApplicationID(id)) {
- LOG(ERROR) << "Failed to obtain Application ID from SQL query";
- return false;
- }
- app_ids.push_back(id);
- }
-
- return true;
-}
-
-bool ApplicationStorageImpl::AddApplication(const ApplicationData* application,
- const base::Time& install_time) {
- if (!db_initialized_) {
- LOG(ERROR) << "The database hasn't been initilized.";
- return false;
- }
-
- return (SetApplicationValue(
- application, install_time, db_fields::kSetApplicationWithBindOp) &&
- SetPermissions(application->ID(), application->permission_map_));
-}
-
-bool ApplicationStorageImpl::UpdateApplication(
- ApplicationData* application, const base::Time& install_time) {
- if (!db_initialized_) {
- LOG(ERROR) << "The database hasn't been initilized.";
- return false;
- }
-
- if (SetApplicationValue(
- application, install_time, db_fields::kUpdateApplicationWithBindOp) &&
- UpdatePermissions(application->ID(), application->permission_map_)) {
- return true;
- }
-
- return false;
-}
-
-bool ApplicationStorageImpl::RemoveApplication(const std::string& id) {
- if (!db_initialized_) {
- LOG(ERROR) << "The database hasn't been initilized.";
- return false;
- }
-
- sql::Transaction transaction(sqlite_db_.get());
- if (!transaction.Begin())
- return false;
-
- sql::Statement smt(sqlite_db_->GetUniqueStatement(
- db_fields::kDeleteApplicationWithBindOp));
- smt.BindString(0, id);
- if (!smt.Run()) {
- LOG(ERROR) << "Could not delete application "
- "information from DB.";
- return false;
- }
-
- return transaction.Commit();
-}
-
-bool ApplicationStorageImpl::ContainsApplication(const std::string& app_id) {
- return GetApplicationData(app_id) != NULL;
-}
-
-bool ApplicationStorageImpl::SetApplicationValue(
- const ApplicationData* application,
- const base::Time& install_time,
- const std::string& operation) {
- if (!application) {
- LOG(ERROR) << "A value is needed when inserting/updating in DB.";
- return false;
- }
-
- std::string manifest;
- JSONStringValueSerializer serializer(&manifest);
- if (!serializer.Serialize(*(application->GetManifest()->value()))) {
- LOG(ERROR) << "An error occured when serializing the manifest value.";
- return false;
- }
-
- sql::Transaction transaction(sqlite_db_.get());
- if (!transaction.Begin())
- return false;
-
- sql::Statement smt(sqlite_db_->GetUniqueStatement(operation.c_str()));
- if (!smt.is_valid()) {
- LOG(ERROR) << "Unable to insert/update application info in DB.";
- return false;
- }
- smt.BindString(0, manifest);
- smt.BindString(1, application->Path().AsUTF8Unsafe());
- smt.BindDouble(2, install_time.ToDoubleT());
- smt.BindString(3, application->ID());
- if (!smt.Run()) {
- LOG(ERROR) << "An error occured when inserting/updating "
- "application info in DB.";
- return false;
- }
-
- return transaction.Commit();
-}
-
-bool ApplicationStorageImpl::SetPermissions(const std::string& id,
- const StoredPermissionMap& permissions) {
- if (!db_initialized_) {
- LOG(ERROR) << "Database is not initialized.";
- return false;
- }
- return SetPermissionsValue(id, permissions,
- db_fields::kInsertPermissionsWithBindOp);
-}
-
-bool ApplicationStorageImpl::UpdatePermissions(const std::string& id,
- const StoredPermissionMap& permissions) {
- if (!db_initialized_) {
- LOG(ERROR) << "Database is not initialized.";
- return false;
- }
- if (permissions.empty())
- return RevokePermissions(id);
-
- return SetPermissionsValue(id, permissions,
- db_fields::kUpdatePermissionsWithBindOp);
-}
-
-bool ApplicationStorageImpl::RevokePermissions(const std::string& id) {
- sql::Transaction transaction(sqlite_db_.get());
- if (!transaction.Begin())
- return false;
-
- sql::Statement statement(sqlite_db_->GetUniqueStatement(
- db_fields::kDeletePermissionsWithBindOp));
- statement.BindString(0, id);
-
- if (!statement.Run()) {
- LOG(ERROR) <<
- "An error occurred while removing permissions.";
- return false;
- }
- return transaction.Commit();
-}
-
-bool ApplicationStorageImpl::SetPermissionsValue(
- const std::string& id,
- const StoredPermissionMap& permissions,
- const std::string& operation) {
- sql::Transaction transaction(sqlite_db_.get());
- std::string permission_str = ToString(permissions);
-
- if (!transaction.Begin())
- return false;
-
- sql::Statement statement(sqlite_db_->GetUniqueStatement(
- operation.c_str()));
- statement.BindString(0, permission_str);
- statement.BindString(1, id);
- if (!statement.Run()) {
- LOG(ERROR) <<
- "An error occurred while inserting permissions.";
- return false;
- }
- return transaction.Commit();
-}
-
-} // namespace application
-} // namespace xwalk
+++ /dev/null
-// Copyright (c) 2013 Intel Corporation. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef XWALK_APPLICATION_COMMON_APPLICATION_STORAGE_IMPL_H_
-#define XWALK_APPLICATION_COMMON_APPLICATION_STORAGE_IMPL_H_
-
-#include <set>
-#include <string>
-#include <utility>
-#include <vector>
-
-#include "base/files/file_path.h"
-#include "sql/connection.h"
-#include "sql/meta_table.h"
-#include "xwalk/application/common/application_data.h"
-
-namespace xwalk {
-namespace application {
-
-// The Sqlite backend implementation of ApplicationStorage.
-class ApplicationStorageImpl {
- public:
- static const base::FilePath::CharType kDBFileName[];
- explicit ApplicationStorageImpl(const base::FilePath& path);
- ~ApplicationStorageImpl();
-
- bool AddApplication(const ApplicationData* application,
- const base::Time& install_time);
- bool RemoveApplication(const std::string& key);
- bool ContainsApplication(const std::string& key);
- bool UpdateApplication(ApplicationData* application,
- const base::Time& install_time);
- bool Init();
-
- scoped_refptr<ApplicationData> GetApplicationData(const std::string& id);
- bool GetInstalledApplications(
- ApplicationData::ApplicationDataMap& applications); // NOLINT
-
- bool GetInstalledApplicationIDs(
- std::vector<std::string>& app_ids); // NOLINT
-
- private:
- scoped_refptr<ApplicationData> ExtractApplicationData(
- const sql::Statement& smt);
- bool UpgradeToVersion1(const base::FilePath& v0_file);
- bool SetApplicationValue(const ApplicationData* application,
- const base::Time& install_time,
- const std::string& operation);
- // Permissions helper functions
- bool SetPermissionsValue(const std::string& id,
- const StoredPermissionMap& permissions,
- const std::string& operation);
- bool SetPermissions(const std::string& id,
- const StoredPermissionMap& permissions);
- bool UpdatePermissions(const std::string& id,
- const StoredPermissionMap& permissions);
- bool RevokePermissions(const std::string& id);
-
- scoped_ptr<sql::Connection> sqlite_db_;
- sql::MetaTable meta_table_;
- base::FilePath data_path_;
- bool db_initialized_;
-};
-
-} // namespace application
-} // namespace xwalk
-
-#endif // XWALK_APPLICATION_COMMON_APPLICATION_STORAGE_IMPL_H_
+++ /dev/null
-// Copyright (c) 2013 Intel Corporation. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "xwalk/application/common/application_storage_impl.h"
-
-#include "base/file_util.h"
-#include "base/files/scoped_temp_dir.h"
-#include "base/json/json_file_value_serializer.h"
-#include "base/logging.h"
-#include "base/path_service.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "xwalk/application/common/application_storage.h"
-#include "xwalk/application/common/application_manifest_constants.h"
-
-namespace xwalk {
-
-namespace keys = application_manifest_keys;
-
-namespace application {
-
-class ApplicationStorageImplTest : public testing::Test {
- public:
- void TestInit() {
- base::FilePath tmp;
- ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &tmp));
- ASSERT_TRUE(temp_dir_.CreateUniqueTempDirUnderPath(tmp));
- app_storage_impl_.reset(new ApplicationStorageImpl(temp_dir_.path()));
- ASSERT_TRUE(app_storage_impl_->Init());
- }
-
- protected:
- base::ScopedTempDir temp_dir_;
- scoped_ptr<ApplicationStorageImpl> app_storage_impl_;
-};
-
-TEST_F(ApplicationStorageImplTest, CreateDBFile) {
- TestInit();
- EXPECT_TRUE(base::PathExists(
- temp_dir_.path().Append(ApplicationStorageImpl::kDBFileName)));
-}
-
-TEST_F(ApplicationStorageImplTest, DBInsert) {
- TestInit();
- base::DictionaryValue manifest;
- manifest.SetString(keys::kNameKey, "no name");
- manifest.SetString(keys::kXWalkVersionKey, "0");
- manifest.SetString("a", "b");
- std::string error;
- scoped_refptr<ApplicationData> application = ApplicationData::Create(
- base::FilePath(),
- ApplicationData::LOCAL_DIRECTORY,
- manifest,
- "",
- &error);
- ASSERT_TRUE(error.empty());
- ASSERT_TRUE(application);
- EXPECT_TRUE(app_storage_impl_->AddApplication(application.get(),
- base::Time::FromDoubleT(0)));
- ApplicationData::ApplicationDataMap applications;
- ASSERT_TRUE(app_storage_impl_->GetInstalledApplications(applications));
- EXPECT_EQ(applications.size(), 1);
- EXPECT_TRUE(applications[application->ID()]);
-}
-
-TEST_F(ApplicationStorageImplTest, DBDelete) {
- TestInit();
- base::DictionaryValue manifest;
- manifest.SetString(keys::kNameKey, "no name");
- manifest.SetString(keys::kXWalkVersionKey, "0");
- manifest.SetString("a", "b");
- std::string error;
- scoped_refptr<ApplicationData> application =
- ApplicationData::Create(base::FilePath(),
- ApplicationData::INTERNAL,
- manifest,
- "",
- &error);
- ASSERT_TRUE(error.empty());
- EXPECT_TRUE(application);
- EXPECT_TRUE(app_storage_impl_->AddApplication(application.get(),
- base::Time::FromDoubleT(0)));
-
- EXPECT_TRUE(app_storage_impl_->RemoveApplication(application->ID()));
- ApplicationData::ApplicationDataMap applications;
- ASSERT_TRUE(app_storage_impl_->GetInstalledApplications(applications));
- EXPECT_EQ(applications.size(), 0);
-}
-
-TEST_F(ApplicationStorageImplTest, DBUpgradeToV1) {
- base::FilePath tmp;
- ASSERT_TRUE(PathService::Get(base::DIR_TEMP, &tmp));
- ASSERT_TRUE(temp_dir_.CreateUniqueTempDirUnderPath(tmp));
-
- scoped_ptr<base::DictionaryValue> db_value(new base::DictionaryValue);
- scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue);
- value->SetString("path", "");
- base::DictionaryValue* manifest = new base::DictionaryValue;
- manifest->SetString("a", "b");
- manifest->SetString(keys::kNameKey, "no name");
- manifest->SetString(keys::kXWalkVersionKey, "0");
- value->Set("manifest", manifest);
- value->SetDouble("install_time", 0);
- db_value->Set("test_id", value.release());
-
- base::FilePath v0_db_file(
- temp_dir_.path().AppendASCII("applications_db"));
- JSONFileValueSerializer serializer(v0_db_file);
- ASSERT_TRUE(serializer.Serialize(*db_value.get()));
- ASSERT_TRUE(base::PathExists(v0_db_file));
-
- app_storage_impl_.reset(new ApplicationStorageImpl(temp_dir_.path()));
- ASSERT_TRUE(app_storage_impl_->Init());
- ApplicationData::ApplicationDataMap applications;
- ASSERT_TRUE(app_storage_impl_->GetInstalledApplications(applications));
- ASSERT_FALSE(base::PathExists(v0_db_file));
- EXPECT_EQ(applications.size(), 1);
- EXPECT_TRUE(applications["test_id"]);
-}
-
-TEST_F(ApplicationStorageImplTest, DBUpdate) {
- TestInit();
- base::DictionaryValue manifest;
- manifest.SetString(keys::kNameKey, "no name");
- manifest.SetString(keys::kXWalkVersionKey, "0");
- manifest.SetString("a", "b");
- std::string error;
- scoped_refptr<ApplicationData> application =
- ApplicationData::Create(base::FilePath(),
- ApplicationData::INTERNAL,
- manifest,
- "",
- &error);
- ASSERT_TRUE(error.empty());
- ASSERT_TRUE(application);
- EXPECT_TRUE(app_storage_impl_->AddApplication(application.get(),
- base::Time::FromDoubleT(0)));
-
- manifest.SetString("a", "c");
- scoped_refptr<ApplicationData> new_application =
- ApplicationData::Create(base::FilePath(),
- ApplicationData::INTERNAL,
- manifest,
- "",
- &error);
- ASSERT_TRUE(error.empty());
- ASSERT_TRUE(new_application);
- EXPECT_TRUE(app_storage_impl_->UpdateApplication(new_application.get(),
- base::Time::FromDoubleT(0)));
- ApplicationData::ApplicationDataMap applications;
- ASSERT_TRUE(app_storage_impl_->GetInstalledApplications(applications));
- EXPECT_EQ(applications.size(), 1);
- scoped_refptr<ApplicationData> saved_application =
- applications[new_application->ID()];
- EXPECT_TRUE(saved_application);
-
- EXPECT_TRUE(saved_application->GetManifest()->value()->Equals(
- new_application->GetManifest()->value()));
-}
-
-TEST_F(ApplicationStorageImplTest, SetPermission) {
- TestInit();
- base::DictionaryValue manifest;
- manifest.SetString(keys::kNameKey, "no name");
- manifest.SetString(keys::kXWalkVersionKey, "0");
- manifest.SetString("a", "b");
- std::string error;
- scoped_refptr<ApplicationData> application =
- ApplicationData::Create(base::FilePath(),
- ApplicationData::INTERNAL,
- manifest,
- "",
- &error);
- ASSERT_TRUE(error.empty());
- ASSERT_TRUE(application);
- EXPECT_TRUE(application->SetPermission("permission", ALLOW));
- EXPECT_TRUE(app_storage_impl_->AddApplication(application.get(),
- base::Time::FromDoubleT(0)));
-
- ApplicationData::ApplicationDataMap applications;
- ASSERT_TRUE(app_storage_impl_->GetInstalledApplications(applications));
- EXPECT_EQ(applications.size(), 1);
- EXPECT_TRUE(applications[application->ID()]);
- EXPECT_TRUE(
- applications[application->ID()]->GetPermission("permission") == ALLOW);
-}
-
-} // namespace application
-} // namespace xwalk
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "xwalk/application/common/application_storage.h"
+#include "xwalk/application/common/tizen/application_storage.h"
-#if defined(OS_TIZEN)
-#include "xwalk/application/common/application_storage_impl_tizen.h"
-#else
-#include "xwalk/application/common/application_storage_impl.h"
-#endif
+#include "xwalk/application/common/tizen/application_storage_impl.h"
namespace xwalk {
namespace application {
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef XWALK_APPLICATION_COMMON_APPLICATION_STORAGE_H_
-#define XWALK_APPLICATION_COMMON_APPLICATION_STORAGE_H_
+#ifndef XWALK_APPLICATION_COMMON_TIZEN_APPLICATION_STORAGE_H_
+#define XWALK_APPLICATION_COMMON_TIZEN_APPLICATION_STORAGE_H_
#include <string>
#include <vector>
} // namespace application
} // namespace xwalk
-#endif // XWALK_APPLICATION_COMMON_APPLICATION_STORAGE_H_
+#endif // XWALK_APPLICATION_COMMON_TIZEN_APPLICATION_STORAGE_H_
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "xwalk/application/common/application_storage_impl_tizen.h"
+#include "xwalk/application/common/tizen/application_storage_impl.h"
#include <ail.h>
#include <pkgmgr-info.h>
#include "base/file_util.h"
#include "third_party/re2/re2/re2.h"
#include "xwalk/application/common/application_file_util.h"
-#include "xwalk/application/common/application_storage.h"
#include "xwalk/application/common/id_util.h"
+#include "xwalk/application/common/tizen/application_storage.h"
#include "xwalk/application/common/tizen/package_path.h"
namespace {
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef XWALK_APPLICATION_COMMON_APPLICATION_STORAGE_IMPL_TIZEN_H_
-#define XWALK_APPLICATION_COMMON_APPLICATION_STORAGE_IMPL_TIZEN_H_
+#ifndef XWALK_APPLICATION_COMMON_TIZEN_APPLICATION_STORAGE_IMPL_H_
+#define XWALK_APPLICATION_COMMON_TIZEN_APPLICATION_STORAGE_IMPL_H_
#include <set>
#include <string>
} // namespace application
} // namespace xwalk
-#endif // XWALK_APPLICATION_COMMON_APPLICATION_STORAGE_IMPL_TIZEN_H_
+#endif // XWALK_APPLICATION_COMMON_TIZEN_APPLICATION_STORAGE_IMPL_H_
'../../../third_party/zlib/google/zip.gyp:zip',
],
'sources': [
- 'application_storage.cc',
- 'application_storage.h',
-
'application_data.cc',
'application_data.h',
'application_file_util.cc',
'application_manifest_constants.h',
'application_resource.cc',
'application_resource.h',
- 'application_storage_constants.cc',
- 'application_storage_constants.h',
'constants.cc',
'constants.h',
'id_util.cc',
'../../../third_party/re2/re2.gyp:re2',
],
'sources': [
- 'application_storage_impl_tizen.cc',
- 'application_storage_impl_tizen.h',
'manifest_handlers/navigation_handler.cc',
'manifest_handlers/navigation_handler.h',
'manifest_handlers/tizen_application_handler.cc',
'manifest_handlers/tizen_setting_handler.h',
'manifest_handlers/tizen_splash_screen_handler.cc',
'manifest_handlers/tizen_splash_screen_handler.h',
+ 'tizen/application_storage.cc',
+ 'tizen/application_storage.h',
+ 'tizen/application_storage_impl.cc',
+ 'tizen/application_storage_impl.h',
'tizen/package_path.cc',
'tizen/package_path.h',
'tizen/signature_data.h',
'tizen/signature_validator.h',
],
- }, {
- 'sources': [
- 'application_storage_impl.cc',
- 'application_storage_impl.h',
- ]
}],
],
'include_dirs': [
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/singleton.h"
-#include "xwalk/application/common/application_storage.h"
+#include "xwalk/application/common/tizen/application_storage.h"
template <typename Type>
struct PkgmgrBackendPluginTraits : DefaultSingletonTraits<Type> {
#include "xwalk/application/common/application_data.h"
#include "xwalk/application/common/application_file_util.h"
#include "xwalk/application/common/application_manifest_constants.h"
-#include "xwalk/application/common/application_storage.h"
#include "xwalk/application/common/id_util.h"
#include "xwalk/application/common/manifest_handlers/tizen_application_handler.h"
#include "xwalk/application/common/manifest_handlers/tizen_metadata_handler.h"
#include "xwalk/application/common/permission_policy_manager.h"
+#include "xwalk/application/common/tizen/application_storage.h"
#include "xwalk/application/tools/tizen/xwalk_packageinfo_constants.h"
#include "xwalk/runtime/common/xwalk_paths.h"
#include "dbus/message.h"
#include "dbus/object_proxy.h"
-#include "xwalk/application/common/application_storage.h"
+#include "xwalk/application/common/tizen/application_storage.h"
#include "xwalk/application/tools/linux/dbus_connection.h"
#include "xwalk/application/tools/tizen/xwalk_package_installer.h"
#include "xwalk/runtime/common/xwalk_paths.h"
'xwalk_core_library_java.jar'),
'classes.jar'),
)
+ # This is a list of files that will not be packaged: mostly a blacklist of
+ # files within |dirs|.
+ exclude_files = (
+ os.path.join(options.target, 'xwalk_core_library', 'libs',
+ 'xwalk_core_library_java.jar'),
+ )
aar_path = os.path.join(options.target, 'xwalk_core_library.aar')
with zipfile.ZipFile(aar_path, 'w') as aar_file:
for f in files:
real_path = os.path.join(root, f)
zip_path = os.path.join(dest, os.path.relpath(root, src), f)
+ if real_path in exclude_files:
+ continue
aar_file.write(real_path, zip_path)
return 0
%endif
Name: crosswalk
-Version: 9.38.204.0
+Version: 9.38.205.0
Release: 0
Summary: Chromium-based app runtime
License: (BSD-3-Clause and LGPL-2.1+)
/**
* The key string to enable/disable animatable XWalkViewInternal. Default value is
- * false.
+ * true.
*
+ * If this key is set to False, then SurfaceView will be created internally as the
+ * rendering backend.
* If this key is set to True, the XWalkViewInternal created by Crosswalk can be
* transformed and animated. Internally, Crosswalk is alternatively using
* TextureView as the backend of XWalkViewInternal.
"support-multiple-windows";
/**
+ * The key string to set xwalk profile name.
+ * User data will be kept separated for different profiles.
+ * Profile needs to be set before any XWalkView instance created.
+ * @since 3.0
+ */
+ @XWalkAPI
+ public static final String PROFILE_NAME = "profile-name";
+
+ /**
* The key string to enable/disable javascript.
* TODO(wang16): Remove this after cordova removes its dependency.
*/
static {
sPrefMap.put(REMOTE_DEBUGGING, new PreferenceValue(false));
- sPrefMap.put(ANIMATABLE_XWALK_VIEW, new PreferenceValue(false));
+ sPrefMap.put(ANIMATABLE_XWALK_VIEW, new PreferenceValue(true));
sPrefMap.put(ENABLE_JAVASCRIPT, new PreferenceValue(true));
sPrefMap.put(JAVASCRIPT_CAN_OPEN_WINDOW, new PreferenceValue(true));
sPrefMap.put(
ALLOW_UNIVERSAL_ACCESS_FROM_FILE, new PreferenceValue(false));
sPrefMap.put(SUPPORT_MULTIPLE_WINDOWS, new PreferenceValue(true));
sPrefMap.put(ENABLE_EXTENSIONS, new PreferenceValue(true));
+ sPrefMap.put(PROFILE_NAME, new PreferenceValue("Default"));
}
/**
--- /dev/null
+// Copyright (c) 2014 Intel Corporation. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.xwalk.core.internal;
+
+/**
+ * Contains all of the command line switches for crosswalk
+ */
+public abstract class XWalkSwitches {
+ // Native switch - xwalk_switches::kXWalkProfileName
+ public static final String PROFILE_NAME = "profile-name";
+
+ // Prevent instantiation.
+ private XWalkSwitches() {}
+}
throw new RuntimeException("Cannot initialize Crosswalk Core", e);
}
DeviceUtils.addDeviceSpecificUserAgentSwitch(context);
+ CommandLine.getInstance().appendSwitchWithValue(
+ XWalkSwitches.PROFILE_NAME,
+ XWalkPreferencesInternal.getStringValue(XWalkPreferencesInternal.PROFILE_NAME));
try {
BrowserStartupController.get(context).startBrowserProcessesSync(
true);
base::FilePath result;
#if defined(OS_ANDROID)
CHECK(PathService::Get(base::DIR_ANDROID_APP_DATA, &result));
+ CommandLine* cmd_line = CommandLine::ForCurrentProcess();
+ if (cmd_line->HasSwitch(switches::kXWalkProfileName))
+ result = result.Append(
+ cmd_line->GetSwitchValuePath(switches::kXWalkProfileName));
#else
CHECK(PathService::Get(xwalk::DIR_DATA_PATH, &result));
#endif
#include "xwalk/runtime/browser/runtime_context.h"
#include "xwalk/runtime/browser/xwalk_runner.h"
#include "xwalk/runtime/common/xwalk_runtime_features.h"
+#include "xwalk/runtime/common/xwalk_switches.h"
namespace {
if (!PathService::Get(base::DIR_ANDROID_APP_DATA, &user_data_dir)) {
NOTREACHED() << "Failed to get app data directory for Crosswalk";
}
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kXWalkProfileName))
+ user_data_dir = user_data_dir.Append(
+ command_line->GetSwitchValuePath(switches::kXWalkProfileName));
base::FilePath cookie_store_path = user_data_dir.Append(
FILE_PATH_LITERAL("Cookies"));
// state, e.g. cache, localStorage etc.
const char kXWalkDataPath[] = "data-path";
+#if defined(OS_ANDROID)
+// Specifies the separated folder to save user data on Android.
+const char kXWalkProfileName[] = "profile-name";
+#endif
+
} // namespace switches
#ifndef XWALK_RUNTIME_COMMON_XWALK_SWITCHES_H_
#define XWALK_RUNTIME_COMMON_XWALK_SWITCHES_H_
+#include "build/build_config.h"
+
// Defines all command line switches for XWalk.
namespace switches {
extern const char kXWalkAllowExternalExtensionsForRemoteSources[];
extern const char kXWalkDataPath[];
+#if defined(OS_ANDROID)
+extern const char kXWalkProfileName[];
+#endif
+
} // namespace switches
#endif // XWALK_RUNTIME_COMMON_XWALK_SWITCHES_H_
--- /dev/null
+// Copyright (c) 2014 Intel Corporation. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.xwalk.core.xwview.test;
+
+import java.io.File;
+import java.io.FilenameFilter;
+
+import android.app.Activity;
+import android.test.suitebuilder.annotation.SmallTest;
+
+import org.chromium.base.test.util.Feature;
+import org.chromium.net.test.util.TestWebServer;
+import org.xwalk.core.XWalkPreferences;
+
+/**
+ * Test suite for XWalkPreferences.PROFILE_NAME.
+ */
+public class ProfileTest extends XWalkViewTestBase {
+ private final static String TEST_PROFILE_NAME = "test-profile";
+
+ private boolean deleteDir(File f) {
+ if (f.isDirectory()) {
+ File[] files = f.listFiles();
+ if (files == null) return true;
+ for (File subFile : files) {
+ deleteDir(subFile);
+ }
+ }
+ return f.delete();
+ }
+
+ @Override
+ public void setUp() throws Exception {
+ final Activity activity = getActivity();
+ String appDataDir = activity.getFilesDir().getParent();
+ File userDataDir = new File(appDataDir + File.separator + "app_xwalkcore" +
+ File.separator + TEST_PROFILE_NAME);
+ File defaultUserDataDir = new File(appDataDir + File.separator + "app_xwalkcore" +
+ File.separator + "Default");
+ deleteDir(userDataDir);
+ deleteDir(defaultUserDataDir);
+ XWalkPreferences.setValue(XWalkPreferences.PROFILE_NAME, TEST_PROFILE_NAME);
+ XWalkPreferences.setValue(XWalkPreferences.REMOTE_DEBUGGING, true);
+ super.setUp();
+ }
+
+ @SmallTest
+ @Feature({"Profile"})
+ public void testCustomizeProfile() throws Throwable {
+ TestWebServer webServer = null;
+ try {
+ webServer = new TestWebServer(false);
+ final String testHtml = getFileContent("profile.html");
+ final String testPath = "/profile.html";
+ final String testUrl = webServer.setResponse(testPath, testHtml, null);
+
+ loadUrlSync(testUrl);
+ assertEquals("Profile Test", getTitleOnUiThread());
+ // Visiting test WebServer will generate Cache and Cookies, plus the local
+ // storage generated by js code, all kinds of user data are covered.
+ executeJavaScriptAndWaitForResult("useLocalStorage();");
+ final Activity activity = getActivity();
+ String appDataDir = activity.getFilesDir().getParent();
+ File userDataDir = new File(appDataDir + File.separator + "app_xwalkcore" +
+ File.separator + TEST_PROFILE_NAME);
+ File defaultUserDataDir = new File(appDataDir + File.separator + "app_xwalkcore" +
+ File.separator + "Default");
+ assertTrue(userDataDir.isDirectory());
+ assertFalse(defaultUserDataDir.exists());
+ } finally {
+ if (webServer != null) webServer.shutdown();
+ }
+ }
+}
--- /dev/null
+<html>
+<head>
+<title>
+Profile Test
+</title>
+<script>
+function useLocalStorage() {
+ localStorage.setItem("profile", "test");
+ console.log("use local storage");
+}
+</script>
+</head>
+<body>
+</body>
+</html>
+
'<(PRODUCT_DIR)/xwalk_xwview_test/assets/framesEcho.html',
'<(PRODUCT_DIR)/xwalk_xwview_test/assets/fullscreen_enter_exit.html',
'<(PRODUCT_DIR)/xwalk_xwview_test/assets/index.html',
+ '<(PRODUCT_DIR)/xwalk_xwview_test/assets/profile.html',
'<(PRODUCT_DIR)/xwalk_xwview_test/assets/scale_changed.html',
'<(PRODUCT_DIR)/xwalk_xwview_test/assets/window.close.html',
],
'test/android/data/framesEcho.html',
'test/android/data/fullscreen_enter_exit.html',
'test/android/data/index.html',
+ 'test/android/data/profile.html',
'test/android/data/scale_changed.html',
'test/android/data/window.close.html',
],
'xwalk_runtime',
],
'sources': [
- 'application/common/application_storage_impl_unittest.cc',
'application/common/package/package_unittest.cc',
'application/common/application_unittest.cc',
'application/common/application_file_util_unittest.cc',