Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1428)

Unified Diff: chrome/browser/extensions/app_background_page_apitest.cc

Issue 128433005: Revert of Test Keeping NaCl plugins used in app background pages alive when active. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/DEPS ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/app_background_page_apitest.cc
diff --git a/chrome/browser/extensions/app_background_page_apitest.cc b/chrome/browser/extensions/app_background_page_apitest.cc
index c221f4f569233fd5f7801ce982f61c2c468f1bd2..90db425dd3b4ba8648498fe9114bf4bcdb4d0cde 100644
--- a/chrome/browser/extensions/app_background_page_apitest.cc
+++ b/chrome/browser/extensions/app_background_page_apitest.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/path_service.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/background/background_contents_service.h"
@@ -12,13 +11,10 @@
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/browser_window.h"
-#include "chrome/browser/ui/extensions/application_launch.h"
-#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "content/public/browser/notification_service.h"
#include "content/public/test/test_notification_tracker.h"
@@ -27,7 +23,6 @@
#include "extensions/common/switches.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
-#include "ppapi/shared_impl/ppapi_switches.h"
#if defined(OS_MACOSX)
#include "base/mac/scoped_nsautorelease_pool.h"
@@ -114,88 +109,6 @@
base::ScopedTempDir app_dir_;
};
-namespace {
-
-// Fixture to assist in testing v2 app background pages containing
-// Native Client embeds.
-class AppBackgroundPageNaClTest : public AppBackgroundPageApiTest {
- public:
- AppBackgroundPageNaClTest()
- : extension_(NULL) {
- PathService::Get(chrome::DIR_GEN_TEST_DATA, &app_dir_);
- app_dir_ = app_dir_.AppendASCII(
- "ppapi/tests/extensions/background_keepalive/newlib");
- }
- virtual ~AppBackgroundPageNaClTest() {
- }
-
- virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
- AppBackgroundPageApiTest::SetUpCommandLine(command_line);
- command_line->AppendSwitchASCII(
- switches::kPpapiKeepAliveThrottle, "50");
- command_line->AppendSwitchASCII(
- extensions::switches::kEventPageIdleTime, "1000");
- command_line->AppendSwitchASCII(
- extensions::switches::kEventPageSuspendingTime, "1000");
- }
-
- const Extension* extension() { return extension_; }
-
- protected:
- void LaunchTestingApp() {
- extension_ = LoadExtension(app_dir_);
- ASSERT_TRUE(extension_);
- }
-
- private:
- base::FilePath app_dir_;
- const Extension* extension_;
-};
-
-// Produces an extensions::ProcessManager::ImpulseCallbackForTesting callback
-// that will match a specified goal and can be waited on.
-class ImpulseCallbackCounter {
- public:
- explicit ImpulseCallbackCounter(const std::string& extension_id)
- : observed_(0),
- goal_(0),
- extension_id_(extension_id) {
- }
-
- extensions::ProcessManager::ImpulseCallbackForTesting
- SetGoalAndGetCallback(int goal) {
- observed_ = 0;
- goal_ = goal;
- message_loop_runner_ = new content::MessageLoopRunner();
- return base::Bind(&ImpulseCallbackCounter::ImpulseCallback,
- base::Unretained(this),
- message_loop_runner_->QuitClosure(),
- extension_id_);
- }
-
- void Wait() {
- message_loop_runner_->Run();
- }
- private:
- void ImpulseCallback(
- const base::Closure& quit_callback,
- const std::string& extension_id_from_test,
- const std::string& extension_id_from_manager) {
- if (extension_id_from_test == extension_id_from_manager) {
- if (++observed_ >= goal_) {
- quit_callback.Run();
- }
- }
- }
-
- int observed_;
- int goal_;
- const std::string extension_id_;
- scoped_refptr<content::MessageLoopRunner> message_loop_runner_;
-};
-
-} // namespace
-
// Disable on Mac only. http://crbug.com/95139
#if defined(OS_MACOSX)
#define MAYBE_Basic DISABLED_Basic
@@ -590,50 +503,3 @@
content::RunAllPendingInMessageLoop();
ASSERT_TRUE(WaitForBackgroundMode(false));
}
-
-// Verify active NaCl embeds cause many keepalive impulses to be sent.
-IN_PROC_BROWSER_TEST_F(AppBackgroundPageNaClTest, BackgroundKeepaliveActive) {
- ExtensionTestMessageListener nacl_modules_loaded("nacl_modules_loaded", true);
- LaunchTestingApp();
- extensions::ProcessManager* manager =
- extensions::ExtensionSystem::Get(browser()->profile())->process_manager();
- ImpulseCallbackCounter active_impulse_counter(extension()->id());
- EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied());
-
- // Target .5 seconds: .5 seconds / 50ms throttle * 2 embeds == 20 impulses.
- manager->SetKeepaliveImpulseCallbackForTesting(
- active_impulse_counter.SetGoalAndGetCallback(20));
- active_impulse_counter.Wait();
-
- // Clear callback to free reference to message loop in ImpulseCallbackCounter.
- manager->SetKeepaliveImpulseCallbackForTesting(
- extensions::ProcessManager::ImpulseCallbackForTesting());
-}
-
-// Verify that nacl modules that go idle will not send keepalive impulses.
-// Disabled on windows due to Win XP failures:
-// DesktopRootWindowHostWin::HandleCreate not implemented. crbug.com/331954
-#if defined(OS_WIN)
-#define MAYBE_BackgroundKeepaliveIdle DISABLED_BackgroundKeepaliveIdle
-#else
-#define MAYBE_BackgroundKeepaliveIdle BackgroundKeepaliveIdle
-#endif
-IN_PROC_BROWSER_TEST_F(AppBackgroundPageNaClTest,
- MAYBE_BackgroundKeepaliveIdle) {
- ExtensionTestMessageListener nacl_modules_loaded("nacl_modules_loaded", true);
- LaunchTestingApp();
- extensions::ProcessManager* manager =
- extensions::ExtensionSystem::Get(browser()->profile())->process_manager();
- ImpulseCallbackCounter idle_impulse_counter(extension()->id());
- EXPECT_TRUE(nacl_modules_loaded.WaitUntilSatisfied());
-
- manager->SetKeepaliveImpulseDecrementCallbackForTesting(
- idle_impulse_counter.SetGoalAndGetCallback(1));
- nacl_modules_loaded.Reply("be idle");
- idle_impulse_counter.Wait();
-
- // Clear callback to free reference to message loop in ImpulseCallbackCounter.
- manager->SetKeepaliveImpulseDecrementCallbackForTesting(
- extensions::ProcessManager::ImpulseCallbackForTesting());
-}
-
« no previous file with comments | « chrome/browser/extensions/DEPS ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698