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

Unified Diff: ui/views/mus/platform_test_helper_mus.cc

Issue 1667273002: Creates BackgroundShell and uses it in test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix android Created 4 years, 10 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 | « ui/views/mus/DEPS ('k') | ui/views/mus/run_all_unittests_mus.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/platform_test_helper_mus.cc
diff --git a/ui/views/mus/platform_test_helper_mus.cc b/ui/views/mus/platform_test_helper_mus.cc
index f5d1df05c3b7586bc7aca539f92169b0ce3c3453..d1df50a4cb840111c164b8d0c7e148bef03144a4 100644
--- a/ui/views/mus/platform_test_helper_mus.cc
+++ b/ui/views/mus/platform_test_helper_mus.cc
@@ -4,45 +4,54 @@
#include "ui/views/test/platform_test_helper.h"
-#include "base/path_service.h"
-#include "mojo/shell/public/cpp/application_test_base.h"
-#include "mojo/shell/public/cpp/shell.h"
-#include "ui/aura/env.h"
-#include "ui/base/resource/resource_bundle.h"
-#include "ui/base/ui_base_paths.h"
-#include "ui/gl/test/gl_surface_test_support.h"
+#include "base/command_line.h"
+#include "mojo/shell/background/background_shell.h"
+#include "mojo/shell/public/cpp/application_impl.h"
+#include "mojo/shell/public/cpp/shell_client.h"
#include "ui/views/mus/window_manager_connection.h"
+#include "url/gurl.h"
namespace views {
namespace {
+class DefaultShellClient : public mojo::ShellClient {
+ public:
+ DefaultShellClient() {}
+ ~DefaultShellClient() override {}
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DefaultShellClient);
+};
+
class PlatformTestHelperMus : public PlatformTestHelper {
public:
PlatformTestHelperMus() {
- gfx::GLSurfaceTestSupport::InitializeOneOff();
-
- // TODO(sky): We really shouldn't need to configure ResourceBundle.
- ui::RegisterPathProvider();
- base::FilePath ui_test_pak_path;
- CHECK(PathService::Get(ui::UI_TEST_PAK, &ui_test_pak_path));
- ui::ResourceBundle::InitSharedInstanceWithPakPath(ui_test_pak_path);
- aura::Env::CreateInstance(true);
+ // Force the new edk.
+ base::CommandLine::ForCurrentProcess()->AppendSwitch("use-new-edk");
- mojo_test_helper_.reset(new mojo::test::TestHelper(nullptr));
+ background_shell_.reset(new mojo::shell::BackgroundShell);
+ background_shell_->Init();
+ shell_client_.reset(new DefaultShellClient);
+ app_.reset(new mojo::ApplicationImpl(
+ shell_client_.get(),
+ background_shell_->CreateApplication(GURL("mojo://test-app"))));
+ app_->WaitForInitialize();
// ui/views/mus requires a WindowManager running, for now use the desktop
// one.
- mojo_test_helper_->shell()->Connect("mojo:desktop_wm");
- WindowManagerConnection::Create(mojo_test_helper_->shell());
+ app_->Connect("mojo:desktop_wm");
+ WindowManagerConnection::Create(app_.get());
}
~PlatformTestHelperMus() override {
- mojo_test_helper_.reset(nullptr);
- aura::Env::DeleteInstance();
- ui::ResourceBundle::CleanupSharedInstance();
+ WindowManagerConnection::Reset();
+ // |app_| has a reference to us, destroy it while we are still valid.
+ app_.reset();
}
private:
- scoped_ptr<mojo::test::TestHelper> mojo_test_helper_;
+ scoped_ptr<mojo::shell::BackgroundShell> background_shell_;
+ scoped_ptr<mojo::ApplicationImpl> app_;
+ scoped_ptr<DefaultShellClient> shell_client_;
DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus);
};
« no previous file with comments | « ui/views/mus/DEPS ('k') | ui/views/mus/run_all_unittests_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698