Commit b9129716 authored by jamescook's avatar jamescook Committed by Commit bot

Move AppWindowGeometryCacheTest to extensions_unittests

It was running in Chrome's unit_tests for historical reasons.

* Remove usage of Chrome's TestExtensionPrefs by instantiating our own
  simplified ExtensionPrefs.
* Move ShellAppSorting to NullAppSorting so it can be used for the above
  as well as app_shell.

BUG=397164
TEST=extensions_unittests

Review URL: https://codereview.chromium.org/549663002

Cr-Commit-Position: refs/heads/master@{#293768}
parent 9cd9f5a5
...@@ -534,7 +534,6 @@ ...@@ -534,7 +534,6 @@
# extensions_unittests running in the bots yet. Until that happens, # extensions_unittests running in the bots yet. Until that happens,
# they should be kept here. # they should be kept here.
'../extensions/browser/api/power/power_api_unittest.cc', '../extensions/browser/api/power/power_api_unittest.cc',
'../extensions/browser/app_window/app_window_geometry_cache_unittest.cc',
'../extensions/common/extension_l10n_util_unittest.cc', '../extensions/common/extension_l10n_util_unittest.cc',
'../extensions/common/features/base_feature_provider_unittest.cc', '../extensions/common/features/base_feature_provider_unittest.cc',
'../extensions/common/features/complex_feature_unittest.cc', '../extensions/common/features/complex_feature_unittest.cc',
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "extensions/shell/browser/shell_app_sorting.h" #include "extensions/browser/null_app_sorting.h"
#include "sync/api/string_ordinal.h" #include "sync/api/string_ordinal.h"
...@@ -17,88 +17,88 @@ const char kFirstPage[] = "a"; ...@@ -17,88 +17,88 @@ const char kFirstPage[] = "a";
namespace extensions { namespace extensions {
ShellAppSorting::ShellAppSorting() { NullAppSorting::NullAppSorting() {
} }
ShellAppSorting::~ShellAppSorting() { NullAppSorting::~NullAppSorting() {
} }
void ShellAppSorting::SetExtensionScopedPrefs(ExtensionScopedPrefs* prefs) { void NullAppSorting::SetExtensionScopedPrefs(ExtensionScopedPrefs* prefs) {
} }
void ShellAppSorting::SetExtensionSyncService( void NullAppSorting::SetExtensionSyncService(
ExtensionSyncService* extension_sync_service) { ExtensionSyncService* extension_sync_service) {
} }
void ShellAppSorting::Initialize(const ExtensionIdList& extension_ids) { void NullAppSorting::Initialize(const ExtensionIdList& extension_ids) {
} }
void ShellAppSorting::FixNTPOrdinalCollisions() { void NullAppSorting::FixNTPOrdinalCollisions() {
} }
void ShellAppSorting::EnsureValidOrdinals( void NullAppSorting::EnsureValidOrdinals(
const std::string& extension_id, const std::string& extension_id,
const syncer::StringOrdinal& suggested_page) { const syncer::StringOrdinal& suggested_page) {
} }
void ShellAppSorting::OnExtensionMoved( void NullAppSorting::OnExtensionMoved(
const std::string& moved_extension_id, const std::string& moved_extension_id,
const std::string& predecessor_extension_id, const std::string& predecessor_extension_id,
const std::string& successor_extension_id) { const std::string& successor_extension_id) {
} }
syncer::StringOrdinal ShellAppSorting::GetAppLaunchOrdinal( syncer::StringOrdinal NullAppSorting::GetAppLaunchOrdinal(
const std::string& extension_id) const { const std::string& extension_id) const {
return syncer::StringOrdinal(kFirstApp); return syncer::StringOrdinal(kFirstApp);
} }
void ShellAppSorting::SetAppLaunchOrdinal( void NullAppSorting::SetAppLaunchOrdinal(
const std::string& extension_id, const std::string& extension_id,
const syncer::StringOrdinal& new_app_launch_ordinal) { const syncer::StringOrdinal& new_app_launch_ordinal) {
} }
syncer::StringOrdinal ShellAppSorting::CreateFirstAppLaunchOrdinal( syncer::StringOrdinal NullAppSorting::CreateFirstAppLaunchOrdinal(
const syncer::StringOrdinal& page_ordinal) const { const syncer::StringOrdinal& page_ordinal) const {
return syncer::StringOrdinal(kFirstApp); return syncer::StringOrdinal(kFirstApp);
} }
syncer::StringOrdinal ShellAppSorting::CreateNextAppLaunchOrdinal( syncer::StringOrdinal NullAppSorting::CreateNextAppLaunchOrdinal(
const syncer::StringOrdinal& page_ordinal) const { const syncer::StringOrdinal& page_ordinal) const {
return syncer::StringOrdinal(kNextApp); return syncer::StringOrdinal(kNextApp);
} }
syncer::StringOrdinal ShellAppSorting::CreateFirstAppPageOrdinal() const { syncer::StringOrdinal NullAppSorting::CreateFirstAppPageOrdinal() const {
return syncer::StringOrdinal(kFirstPage); return syncer::StringOrdinal(kFirstPage);
} }
syncer::StringOrdinal ShellAppSorting::GetNaturalAppPageOrdinal() const { syncer::StringOrdinal NullAppSorting::GetNaturalAppPageOrdinal() const {
return syncer::StringOrdinal(kFirstPage); return syncer::StringOrdinal(kFirstPage);
} }
syncer::StringOrdinal ShellAppSorting::GetPageOrdinal( syncer::StringOrdinal NullAppSorting::GetPageOrdinal(
const std::string& extension_id) const { const std::string& extension_id) const {
return syncer::StringOrdinal(kFirstPage); return syncer::StringOrdinal(kFirstPage);
} }
void ShellAppSorting::SetPageOrdinal( void NullAppSorting::SetPageOrdinal(
const std::string& extension_id, const std::string& extension_id,
const syncer::StringOrdinal& new_page_ordinal) { const syncer::StringOrdinal& new_page_ordinal) {
} }
void ShellAppSorting::ClearOrdinals(const std::string& extension_id) { void NullAppSorting::ClearOrdinals(const std::string& extension_id) {
} }
int ShellAppSorting::PageStringOrdinalAsInteger( int NullAppSorting::PageStringOrdinalAsInteger(
const syncer::StringOrdinal& page_ordinal) const { const syncer::StringOrdinal& page_ordinal) const {
return 0; return 0;
} }
syncer::StringOrdinal ShellAppSorting::PageIntegerAsStringOrdinal( syncer::StringOrdinal NullAppSorting::PageIntegerAsStringOrdinal(
size_t page_index) { size_t page_index) {
return syncer::StringOrdinal(kFirstPage); return syncer::StringOrdinal(kFirstPage);
} }
void ShellAppSorting::SetExtensionVisible(const std::string& extension_id, void NullAppSorting::SetExtensionVisible(const std::string& extension_id,
bool visible) { bool visible) {
} }
......
...@@ -2,20 +2,20 @@ ...@@ -2,20 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef EXTENSIONS_SHELL_BROWSER_SHELL_APP_SORTING_H_ #ifndef EXTENSIONS_BROWSER_NULL_APP_SORTING_H_
#define EXTENSIONS_SHELL_BROWSER_SHELL_APP_SORTING_H_ #define EXTENSIONS_BROWSER_NULL_APP_SORTING_H_
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/macros.h"
#include "extensions/browser/app_sorting.h" #include "extensions/browser/app_sorting.h"
namespace extensions { namespace extensions {
// A stub AppSorting. Since app_shell only runs a single app we don't need to // An AppSorting that doesn't provide any ordering.
// sort them. class NullAppSorting : public AppSorting {
class ShellAppSorting : public AppSorting {
public: public:
ShellAppSorting(); NullAppSorting();
virtual ~ShellAppSorting(); virtual ~NullAppSorting();
// AppSorting overrides: // AppSorting overrides:
virtual void SetExtensionScopedPrefs(ExtensionScopedPrefs* prefs) OVERRIDE; virtual void SetExtensionScopedPrefs(ExtensionScopedPrefs* prefs) OVERRIDE;
...@@ -55,9 +55,9 @@ class ShellAppSorting : public AppSorting { ...@@ -55,9 +55,9 @@ class ShellAppSorting : public AppSorting {
bool visible) OVERRIDE; bool visible) OVERRIDE;
private: private:
DISALLOW_COPY_AND_ASSIGN(ShellAppSorting); DISALLOW_COPY_AND_ASSIGN(NullAppSorting);
}; };
} // namespace extensions } // namespace extensions
#endif // EXTENSIONS_SHELL_BROWSER_SHELL_APP_SORTING_H_ #endif // EXTENSIONS_BROWSER_NULL_APP_SORTING_H_
...@@ -597,6 +597,8 @@ ...@@ -597,6 +597,8 @@
'browser/management_policy.cc', 'browser/management_policy.cc',
'browser/management_policy.h', 'browser/management_policy.h',
'browser/notification_types.h', 'browser/notification_types.h',
'browser/null_app_sorting.cc',
'browser/null_app_sorting.h',
'browser/pref_names.cc', 'browser/pref_names.cc',
'browser/pref_names.h', 'browser/pref_names.h',
'browser/process_manager.cc', 'browser/process_manager.cc',
...@@ -977,6 +979,7 @@ ...@@ -977,6 +979,7 @@
'../base/base.gyp:base_prefs_test_support', '../base/base.gyp:base_prefs_test_support',
'../base/base.gyp:test_support_base', '../base/base.gyp:test_support_base',
'../components/components.gyp:keyed_service_content', '../components/components.gyp:keyed_service_content',
'../components/components.gyp:user_prefs',
'../content/content_shell_and_tests.gyp:test_support_content', '../content/content_shell_and_tests.gyp:test_support_content',
'../device/bluetooth/bluetooth.gyp:device_bluetooth_mocks', '../device/bluetooth/bluetooth.gyp:device_bluetooth_mocks',
'../device/serial/serial.gyp:device_serial', '../device/serial/serial.gyp:device_serial',
...@@ -1011,6 +1014,7 @@ ...@@ -1011,6 +1014,7 @@
'browser/api/storage/settings_quota_unittest.cc', 'browser/api/storage/settings_quota_unittest.cc',
'browser/api/storage/storage_api_unittest.cc', 'browser/api/storage/storage_api_unittest.cc',
'browser/api/storage/storage_frontend_unittest.cc', 'browser/api/storage/storage_frontend_unittest.cc',
'browser/app_window/app_window_geometry_cache_unittest.cc',
'browser/computed_hashes_unittest.cc', 'browser/computed_hashes_unittest.cc',
'browser/content_hash_tree_unittest.cc', 'browser/content_hash_tree_unittest.cc',
'browser/event_listener_map_unittest.cc', 'browser/event_listener_map_unittest.cc',
......
...@@ -58,8 +58,6 @@ ...@@ -58,8 +58,6 @@
'browser/media_capture_util.h', 'browser/media_capture_util.h',
'browser/shell_app_delegate.cc', 'browser/shell_app_delegate.cc',
'browser/shell_app_delegate.h', 'browser/shell_app_delegate.h',
'browser/shell_app_sorting.cc',
'browser/shell_app_sorting.h',
'browser/shell_app_window.cc', 'browser/shell_app_window.cc',
'browser/shell_app_window.h', 'browser/shell_app_window.h',
'browser/shell_app_window_controller.h', 'browser/shell_app_window_controller.h',
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
#include "extensions/browser/event_router.h" #include "extensions/browser/event_router.h"
#include "extensions/browser/extension_function_registry.h" #include "extensions/browser/extension_function_registry.h"
#include "extensions/browser/extension_prefs.h" #include "extensions/browser/extension_prefs.h"
#include "extensions/browser/null_app_sorting.h"
#include "extensions/shell/browser/api/generated_api_registration.h" #include "extensions/shell/browser/api/generated_api_registration.h"
#include "extensions/shell/browser/shell_app_sorting.h"
#include "extensions/shell/browser/shell_extension_host_delegate.h" #include "extensions/shell/browser/shell_extension_host_delegate.h"
#include "extensions/shell/browser/shell_extension_system_factory.h" #include "extensions/shell/browser/shell_extension_system_factory.h"
#include "extensions/shell/browser/shell_runtime_api_delegate.h" #include "extensions/shell/browser/shell_runtime_api_delegate.h"
...@@ -161,7 +161,7 @@ void ShellExtensionsBrowserClient::PermitExternalProtocolHandler() { ...@@ -161,7 +161,7 @@ void ShellExtensionsBrowserClient::PermitExternalProtocolHandler() {
} }
scoped_ptr<AppSorting> ShellExtensionsBrowserClient::CreateAppSorting() { scoped_ptr<AppSorting> ShellExtensionsBrowserClient::CreateAppSorting() {
return scoped_ptr<AppSorting>(new ShellAppSorting); return scoped_ptr<AppSorting>(new NullAppSorting);
} }
bool ShellExtensionsBrowserClient::IsRunningInForcedAppMode() { bool ShellExtensionsBrowserClient::IsRunningInForcedAppMode() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment