Compute can_use_lcd_text using property trees.
[chromium-blink-merge.git] / extensions / renderer / mojo / stash_client_unittest.cc
blobec3dc3f2df1157cc532b4139a8e213ca745d7e16
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include <vector>
7 #include "extensions/browser/mojo/stash_backend.h"
8 #include "extensions/common/mojo/stash.mojom.h"
9 #include "extensions/renderer/api_test_base.h"
10 #include "gin/dictionary.h"
11 #include "grit/extensions_renderer_resources.h"
12 #include "third_party/mojo/src/mojo/public/cpp/bindings/lib/message_builder.h"
14 // A test launcher for tests for the stash client defined in
15 // extensions/test/data/stash_client_unittest.js.
17 namespace extensions {
18 class StashClientTest : public ApiTestBase {
19 public:
20 StashClientTest() {}
22 void SetUp() override {
23 ApiTestBase::SetUp();
24 stash_backend_.reset(new StashBackend(base::Closure()));
25 PrepareEnvironment(api_test_env());
28 void PrepareEnvironment(ApiTestEnvironment* env) {
29 env->service_provider()->AddService(base::Bind(
30 &StashBackend::BindToRequest, base::Unretained(stash_backend_.get())));
33 scoped_ptr<StashBackend> stash_backend_;
35 private:
36 DISALLOW_COPY_AND_ASSIGN(StashClientTest);
39 // Test that stashing and restoring work correctly.
40 TEST_F(StashClientTest, StashAndRestore) {
41 ASSERT_NO_FATAL_FAILURE(RunTest("stash_client_unittest.js", "testStash"));
42 env()->context()->DispatchOnUnloadEvent();
43 scoped_ptr<ModuleSystemTestEnvironment> restore_test_env(CreateEnvironment());
44 ApiTestEnvironment restore_environment(restore_test_env.get());
45 PrepareEnvironment(&restore_environment);
46 restore_environment.RunTest("stash_client_unittest.js", "testRetrieve");
49 } // namespace extensions