| 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/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
| 7 #include "chrome/browser/download/download_prefs.h" | 7 #include "chrome/browser/download/download_prefs.h" |
| 8 #include "chrome/browser/extensions/event_router.h" | 8 #include "chrome/browser/extensions/event_router.h" |
| 9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
| 10 #include "chrome/browser/extensions/extension_info_map.h" | 10 #include "chrome/browser/extensions/extension_info_map.h" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 // extension to have MIME type 'application/msword' and the resources that | 87 // extension to have MIME type 'application/msword' and the resources that |
| 88 // should be downloaded by the browser to have MIME type 'plain/text'. | 88 // should be downloaded by the browser to have MIME type 'plain/text'. |
| 89 class StreamsPrivateApiTest : public ExtensionApiTest { | 89 class StreamsPrivateApiTest : public ExtensionApiTest { |
| 90 public: | 90 public: |
| 91 StreamsPrivateApiTest() {} | 91 StreamsPrivateApiTest() {} |
| 92 | 92 |
| 93 virtual ~StreamsPrivateApiTest() {} | 93 virtual ~StreamsPrivateApiTest() {} |
| 94 | 94 |
| 95 virtual void SetUpOnMainThread() OVERRIDE { | 95 virtual void SetUpOnMainThread() OVERRIDE { |
| 96 // Init test server. | 96 // Init test server. |
| 97 test_server_.reset(new HttpServer()); | 97 test_server_.reset(new HttpServer( |
| 98 test_server_->InitializeAndWaitUntilReady(); | 98 content::BrowserThread::GetMessageLoopProxyForThread( |
| 99 content::BrowserThread::IO))); |
| 100 ASSERT_TRUE(test_server_->InitializeAndWaitUntilReady()); |
| 99 test_server_->RegisterRequestHandler(base::Bind(&HandleRequest)); | 101 test_server_->RegisterRequestHandler(base::Bind(&HandleRequest)); |
| 100 | 102 |
| 101 ExtensionApiTest::SetUpOnMainThread(); | 103 ExtensionApiTest::SetUpOnMainThread(); |
| 102 } | 104 } |
| 103 | 105 |
| 104 virtual void CleanUpOnMainThread() OVERRIDE { | 106 virtual void CleanUpOnMainThread() OVERRIDE { |
| 105 // Tear down the test server. | 107 // Tear down the test server. |
| 106 test_server_->ShutdownAndWaitUntilComplete(); | 108 EXPECT_TRUE(test_server_->ShutdownAndWaitUntilComplete()); |
| 107 test_server_.reset(); | 109 test_server_.reset(); |
| 108 ExtensionApiTest::CleanUpOnMainThread(); | 110 ExtensionApiTest::CleanUpOnMainThread(); |
| 109 } | 111 } |
| 110 | 112 |
| 111 void InitializeDownloadSettings() { | 113 void InitializeDownloadSettings() { |
| 112 ASSERT_TRUE(browser()); | 114 ASSERT_TRUE(browser()); |
| 113 ASSERT_TRUE(downloads_dir_.CreateUniqueTempDir()); | 115 ASSERT_TRUE(downloads_dir_.CreateUniqueTempDir()); |
| 114 | 116 |
| 115 // Setup default downloads directory to the scoped tmp directory created for | 117 // Setup default downloads directory to the scoped tmp directory created for |
| 116 // the test. | 118 // the test. |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 // The test extension should not receive any events by now. Send it an event | 305 // The test extension should not receive any events by now. Send it an event |
| 304 // with MIME type "test/done", so it stops waiting for the events. (If there | 306 // with MIME type "test/done", so it stops waiting for the events. (If there |
| 305 // was an event with MIME type 'plain/text', |catcher.GetNextResult()| will | 307 // was an event with MIME type 'plain/text', |catcher.GetNextResult()| will |
| 306 // fail regardless of the sent event; chrome.test.notifySuccess will not be | 308 // fail regardless of the sent event; chrome.test.notifySuccess will not be |
| 307 // called by the extension). | 309 // called by the extension). |
| 308 SendDoneEvent(); | 310 SendDoneEvent(); |
| 309 EXPECT_TRUE(catcher.GetNextResult()); | 311 EXPECT_TRUE(catcher.GetNextResult()); |
| 310 } | 312 } |
| 311 | 313 |
| 312 } // namespace | 314 } // namespace |
| OLD | NEW |