| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/process/process.h" | 9 #include "base/process/process.h" |
| 10 #include "base/run_loop.h" |
| 10 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 12 #include "content/public/test/test_browser_thread.h" | 13 #include "content/public/test/test_browser_thread.h" |
| 13 #include "extensions/browser/extension_function.h" | 14 #include "extensions/browser/extension_function.h" |
| 14 #include "extensions/browser/quota_service.h" | 15 #include "extensions/browser/quota_service.h" |
| 15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 16 | 17 |
| 17 using base::TimeDelta; | 18 using base::TimeDelta; |
| 18 using base::TimeTicks; | 19 using base::TimeTicks; |
| 19 using content::BrowserThread; | 20 using content::BrowserThread; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 class QuotaServiceTest : public testing::Test { | 106 class QuotaServiceTest : public testing::Test { |
| 106 public: | 107 public: |
| 107 QuotaServiceTest() | 108 QuotaServiceTest() |
| 108 : extension_a_("a"), | 109 : extension_a_("a"), |
| 109 extension_b_("b"), | 110 extension_b_("b"), |
| 110 extension_c_("c"), | 111 extension_c_("c"), |
| 111 loop_(), | 112 loop_(), |
| 112 ui_thread_(BrowserThread::UI, &loop_) {} | 113 ui_thread_(BrowserThread::UI, &loop_) {} |
| 113 void SetUp() override { service_.reset(new QuotaService()); } | 114 void SetUp() override { service_.reset(new QuotaService()); } |
| 114 void TearDown() override { | 115 void TearDown() override { |
| 115 loop_.RunUntilIdle(); | 116 base::RunLoop().RunUntilIdle(); |
| 116 service_.reset(); | 117 service_.reset(); |
| 117 } | 118 } |
| 118 | 119 |
| 119 protected: | 120 protected: |
| 120 std::string extension_a_; | 121 std::string extension_a_; |
| 121 std::string extension_b_; | 122 std::string extension_b_; |
| 122 std::string extension_c_; | 123 std::string extension_c_; |
| 123 std::unique_ptr<QuotaService> service_; | 124 std::unique_ptr<QuotaService> service_; |
| 124 base::MessageLoop loop_; | 125 base::MessageLoop loop_; |
| 125 content::TestBrowserThread ui_thread_; | 126 content::TestBrowserThread ui_thread_; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 EXPECT_NE("", service_->Assess(extension_a_, f.get(), &arg, | 325 EXPECT_NE("", service_->Assess(extension_a_, f.get(), &arg, |
| 325 kStartTime + TimeDelta::FromDays(1) + | 326 kStartTime + TimeDelta::FromDays(1) + |
| 326 TimeDelta::FromSeconds(25))); | 327 TimeDelta::FromSeconds(25))); |
| 327 | 328 |
| 328 // Like now. | 329 // Like now. |
| 329 EXPECT_EQ("", service_->Assess(extension_a_, f.get(), &arg, | 330 EXPECT_EQ("", service_->Assess(extension_a_, f.get(), &arg, |
| 330 kStartTime + TimeDelta::FromDays(2))); | 331 kStartTime + TimeDelta::FromDays(2))); |
| 331 } | 332 } |
| 332 | 333 |
| 333 } // namespace extensions | 334 } // namespace extensions |
| OLD | NEW |