OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "extensions/browser/mojo/stash_backend.h" | 8 #include "extensions/browser/mojo/stash_backend.h" |
9 #include "extensions/common/mojo/stash.mojom.h" | 9 #include "extensions/common/mojo/stash.mojom.h" |
10 #include "extensions/renderer/api_test_base.h" | 10 #include "extensions/renderer/api_test_base.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 ApiTestBase::SetUp(); | 24 ApiTestBase::SetUp(); |
25 stash_backend_.reset(new StashBackend(base::Closure())); | 25 stash_backend_.reset(new StashBackend(base::Closure())); |
26 PrepareEnvironment(api_test_env()); | 26 PrepareEnvironment(api_test_env()); |
27 } | 27 } |
28 | 28 |
29 void PrepareEnvironment(ApiTestEnvironment* env) { | 29 void PrepareEnvironment(ApiTestEnvironment* env) { |
30 env->service_provider()->AddService(base::Bind( | 30 env->service_provider()->AddService(base::Bind( |
31 &StashBackend::BindToRequest, base::Unretained(stash_backend_.get()))); | 31 &StashBackend::BindToRequest, base::Unretained(stash_backend_.get()))); |
32 } | 32 } |
33 | 33 |
34 scoped_ptr<StashBackend> stash_backend_; | 34 std::unique_ptr<StashBackend> stash_backend_; |
35 | 35 |
36 private: | 36 private: |
37 DISALLOW_COPY_AND_ASSIGN(StashClientTest); | 37 DISALLOW_COPY_AND_ASSIGN(StashClientTest); |
38 }; | 38 }; |
39 | 39 |
40 // https://crbug.com/599898 | 40 // https://crbug.com/599898 |
41 #if defined(LEAK_SANITIZER) | 41 #if defined(LEAK_SANITIZER) |
42 #define MAYBE_StashAndRestore DISABLED_StashAndRestore | 42 #define MAYBE_StashAndRestore DISABLED_StashAndRestore |
43 #else | 43 #else |
44 #define MAYBE_StashAndRestore StashAndRestore | 44 #define MAYBE_StashAndRestore StashAndRestore |
45 #endif | 45 #endif |
46 // Test that stashing and restoring work correctly. | 46 // Test that stashing and restoring work correctly. |
47 TEST_F(StashClientTest, MAYBE_StashAndRestore) { | 47 TEST_F(StashClientTest, MAYBE_StashAndRestore) { |
48 ASSERT_NO_FATAL_FAILURE(RunTest("stash_client_unittest.js", "testStash")); | 48 ASSERT_NO_FATAL_FAILURE(RunTest("stash_client_unittest.js", "testStash")); |
49 scoped_ptr<ModuleSystemTestEnvironment> restore_test_env(CreateEnvironment()); | 49 std::unique_ptr<ModuleSystemTestEnvironment> restore_test_env( |
| 50 CreateEnvironment()); |
50 ApiTestEnvironment restore_environment(restore_test_env.get()); | 51 ApiTestEnvironment restore_environment(restore_test_env.get()); |
51 PrepareEnvironment(&restore_environment); | 52 PrepareEnvironment(&restore_environment); |
52 restore_environment.RunTest("stash_client_unittest.js", "testRetrieve"); | 53 restore_environment.RunTest("stash_client_unittest.js", "testRetrieve"); |
53 } | 54 } |
54 | 55 |
55 } // namespace extensions | 56 } // namespace extensions |
OLD | NEW |