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

Side by Side Diff: extensions/browser/api/runtime/restart_after_delay_api_unittest.cc

Issue 2562733003: Remove duplicated user_prefs::TestingPrefServiceSyncable (Closed)
Patch Set: Fixed usage from .mm files Created 4 years 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 unified diff | Download patch
« no previous file with comments | « extensions/browser/DEPS ('k') | extensions/browser/api_unittest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/callback_helpers.h" 5 #include "base/callback_helpers.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "components/pref_registry/pref_registry_syncable.h" 7 #include "components/pref_registry/pref_registry_syncable.h"
8 #include "components/pref_registry/testing_pref_service_syncable.h" 8 #include "components/sync_preferences/testing_pref_service_syncable.h"
9 #include "extensions/browser/api/runtime/runtime_api.h" 9 #include "extensions/browser/api/runtime/runtime_api.h"
10 #include "extensions/browser/api_test_utils.h" 10 #include "extensions/browser/api_test_utils.h"
11 #include "extensions/browser/api_unittest.h" 11 #include "extensions/browser/api_unittest.h"
12 #include "extensions/browser/test_extensions_browser_client.h" 12 #include "extensions/browser/test_extensions_browser_client.h"
13 #include "extensions/browser/test_runtime_api_delegate.h" 13 #include "extensions/browser/test_runtime_api_delegate.h"
14 #include "extensions/common/manifest.h" 14 #include "extensions/common/manifest.h"
15 15
16 namespace extensions { 16 namespace extensions {
17 17
18 namespace { 18 namespace {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 return &testing_pref_service_; 65 return &testing_pref_service_;
66 } 66 }
67 67
68 std::unique_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate( 68 std::unique_ptr<RuntimeAPIDelegate> CreateRuntimeAPIDelegate(
69 content::BrowserContext* context) const override { 69 content::BrowserContext* context) const override {
70 const_cast<DelayedRestartExtensionsBrowserClient*>(this)->api_delegate_ = 70 const_cast<DelayedRestartExtensionsBrowserClient*>(this)->api_delegate_ =
71 new DelayedRestartTestApiDelegate(); 71 new DelayedRestartTestApiDelegate();
72 return base::WrapUnique(api_delegate_); 72 return base::WrapUnique(api_delegate_);
73 } 73 }
74 74
75 user_prefs::TestingPrefServiceSyncable* testing_pref_service() { 75 sync_preferences::TestingPrefServiceSyncable* testing_pref_service() {
76 return &testing_pref_service_; 76 return &testing_pref_service_;
77 } 77 }
78 78
79 DelayedRestartTestApiDelegate* api_delegate() const { 79 DelayedRestartTestApiDelegate* api_delegate() const {
80 CHECK(api_delegate_); 80 CHECK(api_delegate_);
81 return api_delegate_; 81 return api_delegate_;
82 } 82 }
83 83
84 private: 84 private:
85 DelayedRestartTestApiDelegate* api_delegate_ = nullptr; // Not owned. 85 DelayedRestartTestApiDelegate* api_delegate_ = nullptr; // Not owned.
86 86
87 user_prefs::TestingPrefServiceSyncable testing_pref_service_; 87 sync_preferences::TestingPrefServiceSyncable testing_pref_service_;
88 88
89 DISALLOW_COPY_AND_ASSIGN(DelayedRestartExtensionsBrowserClient); 89 DISALLOW_COPY_AND_ASSIGN(DelayedRestartExtensionsBrowserClient);
90 }; 90 };
91 91
92 } // namespace 92 } // namespace
93 93
94 class RestartAfterDelayApiTest : public ApiUnitTest { 94 class RestartAfterDelayApiTest : public ApiUnitTest {
95 public: 95 public:
96 RestartAfterDelayApiTest() {} 96 RestartAfterDelayApiTest() {}
97 ~RestartAfterDelayApiTest() override {} 97 ~RestartAfterDelayApiTest() override {}
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 RunRestartAfterDelayFunction( 238 RunRestartAfterDelayFunction(
239 "[1]", "Restart was requested too soon. It was throttled instead."); 239 "[1]", "Restart was requested too soon. It was throttled instead.");
240 ASSERT_TRUE(IsDelayedRestartTimerRunning()); 240 ASSERT_TRUE(IsDelayedRestartTimerRunning());
241 // Restart will happen 2 seconds later, even though the request was just one 241 // Restart will happen 2 seconds later, even though the request was just one
242 // second. 242 // second.
243 ASSERT_NEAR((desired_restart_time() - last_restart_time).InSecondsF(), 243 ASSERT_NEAR((desired_restart_time() - last_restart_time).InSecondsF(),
244 base::TimeDelta::FromSeconds(2).InSecondsF(), 0.5); 244 base::TimeDelta::FromSeconds(2).InSecondsF(), 0.5);
245 } 245 }
246 246
247 } // namespace extensions 247 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/DEPS ('k') | extensions/browser/api_unittest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698