OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/message_loop.h" | 5 #include "base/message_loop.h" |
6 #include "base/process.h" | 6 #include "base/process.h" |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "chrome/browser/extensions/extension_function.h" | 9 #include "chrome/browser/extensions/extension_function.h" |
10 #include "chrome/browser/extensions/extensions_quota_service.h" | 10 #include "chrome/browser/extensions/extensions_quota_service.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 : extension_a_("a"), | 122 : extension_a_("a"), |
123 extension_b_("b"), | 123 extension_b_("b"), |
124 extension_c_("c"), | 124 extension_c_("c"), |
125 loop_(), | 125 loop_(), |
126 ui_thread_(BrowserThread::UI, &loop_) { | 126 ui_thread_(BrowserThread::UI, &loop_) { |
127 } | 127 } |
128 virtual void SetUp() { | 128 virtual void SetUp() { |
129 service_.reset(new ExtensionsQuotaService()); | 129 service_.reset(new ExtensionsQuotaService()); |
130 } | 130 } |
131 virtual void TearDown() { | 131 virtual void TearDown() { |
132 loop_.RunAllPending(); | 132 loop_.RunUntilIdle(); |
133 service_.reset(); | 133 service_.reset(); |
134 } | 134 } |
135 protected: | 135 protected: |
136 std::string extension_a_; | 136 std::string extension_a_; |
137 std::string extension_b_; | 137 std::string extension_b_; |
138 std::string extension_c_; | 138 std::string extension_c_; |
139 scoped_ptr<ExtensionsQuotaService> service_; | 139 scoped_ptr<ExtensionsQuotaService> service_; |
140 MessageLoop loop_; | 140 MessageLoop loop_; |
141 content::TestBrowserThread ui_thread_; | 141 content::TestBrowserThread ui_thread_; |
142 }; | 142 }; |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 EXPECT_NE("", service_->Assess(extension_a_, f, &arg, | 333 EXPECT_NE("", service_->Assess(extension_a_, f, &arg, |
334 kStartTime + TimeDelta::FromSeconds(15))); | 334 kStartTime + TimeDelta::FromSeconds(15))); |
335 | 335 |
336 // We don't allow this extension to use quota limited functions even if they | 336 // We don't allow this extension to use quota limited functions even if they |
337 // wait a while. | 337 // wait a while. |
338 EXPECT_NE("", service_->Assess(extension_a_, f, &arg, | 338 EXPECT_NE("", service_->Assess(extension_a_, f, &arg, |
339 kStartTime + TimeDelta::FromDays(1))); | 339 kStartTime + TimeDelta::FromDays(1))); |
340 EXPECT_NE("", service_->Assess(extension_a_, g, &arg, | 340 EXPECT_NE("", service_->Assess(extension_a_, g, &arg, |
341 kStartTime + TimeDelta::FromDays(1))); | 341 kStartTime + TimeDelta::FromDays(1))); |
342 } | 342 } |
OLD | NEW |