| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/thread.h" | 9 #include "base/thread.h" |
| 10 #include "chrome/browser/chrome_thread.h" |
| 10 #include "chrome/browser/extensions/extensions_service.h" | 11 #include "chrome/browser/extensions/extensions_service.h" |
| 11 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" | 12 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" |
| 12 #include "chrome/common/chrome_paths.h" | 13 #include "chrome/common/chrome_paths.h" |
| 13 #include "chrome/common/chrome_plugin_lib.h" | 14 #include "chrome/common/chrome_plugin_lib.h" |
| 14 #include "chrome/common/notification_service.h" | 15 #include "chrome/common/notification_service.h" |
| 15 #include "chrome/common/render_messages.h" | 16 #include "chrome/common/render_messages.h" |
| 16 #include "chrome/test/testing_profile.h" | 17 #include "chrome/test/testing_profile.h" |
| 17 #include "ipc/ipc_message.h" | 18 #include "ipc/ipc_message.h" |
| 18 #include "net/url_request/url_request.h" | 19 #include "net/url_request/url_request.h" |
| 19 #include "net/url_request/url_request_test_job.h" | 20 #include "net/url_request/url_request_test_job.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 34 : UserScriptMaster(worker, script_dir) {} | 35 : UserScriptMaster(worker, script_dir) {} |
| 35 | 36 |
| 36 virtual void StartScan() { | 37 virtual void StartScan() { |
| 37 // Do nothing. We want to manually control when scans occur. | 38 // Do nothing. We want to manually control when scans occur. |
| 38 } | 39 } |
| 39 void TestStartScan() { | 40 void TestStartScan() { |
| 40 UserScriptMaster::StartScan(); | 41 UserScriptMaster::StartScan(); |
| 41 } | 42 } |
| 42 }; | 43 }; |
| 43 | 44 |
| 44 class MockIOThread : public base::Thread { | 45 class MockIOThread : public ChromeThread { |
| 45 public: | 46 public: |
| 46 MockIOThread() : base::Thread("IO") {} | 47 MockIOThread() : ChromeThread(ChromeThread::IO) {} |
| 47 virtual ~MockIOThread() { Stop(); } | 48 virtual ~MockIOThread() { Stop(); } |
| 48 | 49 |
| 49 private: | 50 private: |
| 50 virtual void Init() { | 51 virtual void Init() { |
| 51 service_.reset(new NotificationService()); | 52 service_.reset(new NotificationService()); |
| 52 } | 53 } |
| 53 virtual void CleanUp() { | 54 virtual void CleanUp() { |
| 54 ChromePluginLib::UnloadAllPlugins(); | 55 ChromePluginLib::UnloadAllPlugins(); |
| 55 service_.reset(); | 56 service_.reset(); |
| 56 } | 57 } |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 300 |
| 300 // Make the same requests, and they should complete instantly. | 301 // Make the same requests, and they should complete instantly. |
| 301 resource_tester_->MakeTestRequest(2, GURL("http://google.com/")); | 302 resource_tester_->MakeTestRequest(2, GURL("http://google.com/")); |
| 302 resource_tester_->MakeTestRequest(3, GURL("http://yahoo.com/")); | 303 resource_tester_->MakeTestRequest(3, GURL("http://yahoo.com/")); |
| 303 | 304 |
| 304 EXPECT_TRUE(resource_tester_->IsRequestStarted(2)); | 305 EXPECT_TRUE(resource_tester_->IsRequestStarted(2)); |
| 305 EXPECT_TRUE(resource_tester_->IsRequestComplete(2)); | 306 EXPECT_TRUE(resource_tester_->IsRequestComplete(2)); |
| 306 EXPECT_TRUE(resource_tester_->IsRequestStarted(3)); | 307 EXPECT_TRUE(resource_tester_->IsRequestStarted(3)); |
| 307 EXPECT_TRUE(resource_tester_->IsRequestComplete(3)); | 308 EXPECT_TRUE(resource_tester_->IsRequestComplete(3)); |
| 308 } | 309 } |
| OLD | NEW |