| OLD | NEW |
| (Empty) |
| 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. | |
| 4 | |
| 5 #include <vector> | |
| 6 | |
| 7 #include "base/macros.h" | |
| 8 #include "extensions/browser/mojo/stash_backend.h" | |
| 9 #include "extensions/common/mojo/stash.mojom.h" | |
| 10 #include "extensions/renderer/api_test_base.h" | |
| 11 #include "gin/dictionary.h" | |
| 12 #include "grit/extensions_renderer_resources.h" | |
| 13 #include "mojo/public/cpp/bindings/lib/message_builder.h" | |
| 14 | |
| 15 // A test launcher for tests for the stash client defined in | |
| 16 // extensions/test/data/stash_client_unittest.js. | |
| 17 | |
| 18 namespace extensions { | |
| 19 class StashClientTest : public ApiTestBase { | |
| 20 public: | |
| 21 StashClientTest() {} | |
| 22 | |
| 23 void SetUp() override { | |
| 24 ApiTestBase::SetUp(); | |
| 25 stash_backend_.reset(new StashBackend(base::Closure())); | |
| 26 PrepareEnvironment(api_test_env()); | |
| 27 } | |
| 28 | |
| 29 void PrepareEnvironment(ApiTestEnvironment* env) { | |
| 30 env->interface_provider()->AddInterface(base::Bind( | |
| 31 &StashBackend::BindToRequest, base::Unretained(stash_backend_.get()))); | |
| 32 } | |
| 33 | |
| 34 std::unique_ptr<StashBackend> stash_backend_; | |
| 35 | |
| 36 private: | |
| 37 DISALLOW_COPY_AND_ASSIGN(StashClientTest); | |
| 38 }; | |
| 39 | |
| 40 // https://crbug.com/599898 | |
| 41 #if defined(LEAK_SANITIZER) | |
| 42 #define MAYBE_StashAndRestore DISABLED_StashAndRestore | |
| 43 #else | |
| 44 #define MAYBE_StashAndRestore StashAndRestore | |
| 45 #endif | |
| 46 // Test that stashing and restoring work correctly. | |
| 47 TEST_F(StashClientTest, MAYBE_StashAndRestore) { | |
| 48 ASSERT_NO_FATAL_FAILURE(RunTest("stash_client_unittest.js", "testStash")); | |
| 49 std::unique_ptr<ModuleSystemTestEnvironment> restore_test_env( | |
| 50 CreateEnvironment()); | |
| 51 ApiTestEnvironment restore_environment(restore_test_env.get()); | |
| 52 PrepareEnvironment(&restore_environment); | |
| 53 restore_environment.RunTest("stash_client_unittest.js", "testRetrieve"); | |
| 54 } | |
| 55 | |
| 56 } // namespace extensions | |
| OLD | NEW |