| 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 "base/cancelable_callback.h" | 5 #include "base/cancelable_callback.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "extensions/common/extension_builder.h" | 23 #include "extensions/common/extension_builder.h" |
| 24 #include "sql/statement.h" | 24 #include "sql/statement.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 26 |
| 27 #if defined(OS_CHROMEOS) | 27 #if defined(OS_CHROMEOS) |
| 28 #include "chrome/browser/chromeos/login/user_manager.h" | 28 #include "chrome/browser/chromeos/login/user_manager.h" |
| 29 #include "chrome/browser/chromeos/settings/cros_settings.h" | 29 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 30 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 30 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 using content::BrowserThread; |
| 34 |
| 33 namespace extensions { | 35 namespace extensions { |
| 34 | 36 |
| 35 class CountingPolicyTest : public testing::Test { | 37 class CountingPolicyTest : public testing::Test { |
| 36 public: | 38 public: |
| 37 CountingPolicyTest() | 39 CountingPolicyTest() |
| 38 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), | 40 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), |
| 39 saved_cmdline_(CommandLine::NO_PROGRAM) { | 41 saved_cmdline_(CommandLine::NO_PROGRAM) { |
| 40 #if defined OS_CHROMEOS | 42 #if defined OS_CHROMEOS |
| 41 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); | 43 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); |
| 42 #endif | 44 #endif |
| (...skipping 12 matching lines...) Expand all Loading... |
| 55 test_user_manager_.reset(); | 57 test_user_manager_.reset(); |
| 56 #endif | 58 #endif |
| 57 base::RunLoop().RunUntilIdle(); | 59 base::RunLoop().RunUntilIdle(); |
| 58 profile_.reset(NULL); | 60 profile_.reset(NULL); |
| 59 base::RunLoop().RunUntilIdle(); | 61 base::RunLoop().RunUntilIdle(); |
| 60 // Restore the original command line and undo the affects of SetUp(). | 62 // Restore the original command line and undo the affects of SetUp(). |
| 61 *CommandLine::ForCurrentProcess() = saved_cmdline_; | 63 *CommandLine::ForCurrentProcess() = saved_cmdline_; |
| 62 } | 64 } |
| 63 | 65 |
| 64 // Wait for the task queue for the specified thread to empty. | 66 // Wait for the task queue for the specified thread to empty. |
| 65 void WaitOnThread(const content::BrowserThread::ID& thread) { | 67 void WaitOnThread(const BrowserThread::ID& thread) { |
| 66 BrowserThread::PostTaskAndReply( | 68 BrowserThread::PostTaskAndReply( |
| 67 thread, | 69 thread, |
| 68 FROM_HERE, | 70 FROM_HERE, |
| 69 base::Bind(&base::DoNothing), | 71 base::Bind(&base::DoNothing), |
| 70 base::MessageLoop::current()->QuitClosure()); | 72 base::MessageLoop::current()->QuitClosure()); |
| 71 base::MessageLoop::current()->Run(); | 73 base::MessageLoop::current()->Run(); |
| 72 } | 74 } |
| 73 | 75 |
| 74 // A wrapper function for CheckReadFilteredData, so that we don't need to | 76 // A wrapper function for CheckReadFilteredData, so that we don't need to |
| 75 // enter empty string values for parameters we don't care about. | 77 // enter empty string values for parameters we don't care about. |
| (...skipping 1032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1108 | 1110 |
| 1109 CheckReadData( | 1111 CheckReadData( |
| 1110 policy, | 1112 policy, |
| 1111 "punky", | 1113 "punky", |
| 1112 0, | 1114 0, |
| 1113 base::Bind(&CountingPolicyTest::CheckDuplicates)); | 1115 base::Bind(&CountingPolicyTest::CheckDuplicates)); |
| 1114 policy->Close(); | 1116 policy->Close(); |
| 1115 } | 1117 } |
| 1116 | 1118 |
| 1117 } // namespace extensions | 1119 } // namespace extensions |
| OLD | NEW |