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

Unified Diff: chrome/test/base/browser_with_test_window_test.cc

Issue 1243033003: App Info: `View in Webstore` closes before navigating (not after) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Likely fix for CrOS Created 5 years, 5 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/test/base/browser_with_test_window_test.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/base/browser_with_test_window_test.cc
diff --git a/chrome/test/base/browser_with_test_window_test.cc b/chrome/test/base/browser_with_test_window_test.cc
index b9e4203302e25bd8566ae87db009ec85ffae5cfc..4f6773bfa7341613487a4bdd055a1db8bf0bc329 100644
--- a/chrome/test/base/browser_with_test_window_test.cc
+++ b/chrome/test/base/browser_with_test_window_test.cc
@@ -20,22 +20,15 @@
#include "content/public/test/test_renderer_host.h"
#include "ui/base/page_transition_types.h"
-#if defined(USE_AURA)
-#include "ui/aura/test/aura_test_helper.h"
-#include "ui/compositor/compositor.h"
-#include "ui/compositor/test/context_factories_for_test.h"
-#include "ui/wm/core/default_activation_client.h"
-#endif
-
-#if defined(USE_ASH)
+#if defined(OS_CHROMEOS)
#include "ash/test/ash_test_helper.h"
-#include "ash/test/ash_test_views_delegate.h"
+#elif defined(TOOLKIT_VIEWS)
+#include "ui/views/test/scoped_views_test_helper.h"
#endif
#if defined(TOOLKIT_VIEWS)
#include "chrome/browser/ui/views/chrome_constrained_window_views_client.h"
#include "components/constrained_window/constrained_window_views.h"
-#include "ui/views/test/test_views_delegate.h"
#endif
using content::NavigationController;
@@ -66,29 +59,16 @@ void BrowserWithTestWindowTest::SetUp() {
#if defined(OS_CHROMEOS)
// TODO(jamescook): Windows Ash support. This will require refactoring
// AshTestHelper and AuraTestHelper so they can be used at the same time,
- // perhaps by AshTestHelper owning an AuraTestHelper. Also, need to cleanup
- // CreateViewsDelegate() below when cleanup done.
+ // perhaps by AshTestHelper owning an AuraTestHelper.
ash_test_helper_.reset(new ash::test::AshTestHelper(
base::MessageLoopForUI::current()));
ash_test_helper_->SetUp(true);
-#elif defined(USE_AURA)
- // The ContextFactory must exist before any Compositors are created.
- bool enable_pixel_output = false;
- ui::ContextFactory* context_factory =
- ui::InitializeContextFactoryForTests(enable_pixel_output);
-
- aura_test_helper_.reset(new aura::test::AuraTestHelper(
- base::MessageLoopForUI::current()));
- aura_test_helper_->SetUp(context_factory);
- new wm::DefaultActivationClient(aura_test_helper_->root_window());
-#endif // USE_AURA
-
+#elif defined(TOOLKIT_VIEWS)
+ views_test_helper_.reset(new views::ScopedViewsTestHelper());
+#endif
#if defined(TOOLKIT_VIEWS)
-#if !defined(OS_CHROMEOS)
- views_delegate_.reset(CreateViewsDelegate());
-#endif // !OS_CHROMEOS
SetConstrainedWindowViewsClient(CreateChromeConstrainedWindowViewsClient());
-#endif // TOOLKIT_VIEWS
+#endif
// Subclasses can provide their own Profile.
profile_ = CreateProfile();
@@ -110,12 +90,16 @@ void BrowserWithTestWindowTest::TearDown() {
// audio service) depend on test stubs that the helpers below will remove.
DestroyBrowserAndProfile();
+#if defined(TOOLKIT_VIEWS)
+ constrained_window::SetConstrainedWindowViewsClient(nullptr);
+#endif
+
#if defined(OS_CHROMEOS)
ash_test_helper_->TearDown();
-#elif defined(USE_AURA)
- aura_test_helper_->TearDown();
- ui::TerminateContextFactoryForTests();
+#elif defined(TOOLKIT_VIEWS)
+ views_test_helper_.reset();
#endif
+
testing::Test::TearDown();
// A Task is leaked if we don't destroy everything, then run the message
@@ -123,10 +107,15 @@ void BrowserWithTestWindowTest::TearDown() {
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::MessageLoop::QuitClosure());
base::MessageLoop::current()->Run();
+}
-#if defined(TOOLKIT_VIEWS)
- constrained_window::SetConstrainedWindowViewsClient(nullptr);
- views_delegate_.reset(NULL);
+gfx::NativeWindow BrowserWithTestWindowTest::GetContext() {
+#if defined(OS_CHROMEOS)
+ return ash_test_helper_->CurrentContext();
+#elif defined(TOOLKIT_VIEWS)
+ return views_test_helper_->GetContext();
+#else
+ return nullptr;
#endif
}
@@ -255,13 +244,3 @@ Browser* BrowserWithTestWindowTest::CreateBrowser(
params.window = browser_window;
return new Browser(params);
}
-
-#if !defined(OS_CHROMEOS) && defined(TOOLKIT_VIEWS)
-views::ViewsDelegate* BrowserWithTestWindowTest::CreateViewsDelegate() {
-#if defined(USE_ASH)
- return new ash::test::AshTestViewsDelegate;
-#else
- return new views::TestViewsDelegate;
-#endif
-}
-#endif
« no previous file with comments | « chrome/test/base/browser_with_test_window_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698