| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "chrome/browser/browser_thread.h" | 7 #include "chrome/browser/browser_thread.h" |
| 8 #include "chrome/browser/child_process_security_policy.h" | 8 #include "chrome/browser/child_process_security_policy.h" |
| 9 #include "chrome/browser/chromeos/login/account_screen.h" | 9 #include "chrome/browser/chromeos/login/account_screen.h" |
| 10 #include "chrome/browser/chromeos/login/wizard_controller.h" | 10 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 EXPECT_EQ(controller()->GetAccountScreen(), controller()->current_screen()); | 55 EXPECT_EQ(controller()->GetAccountScreen(), controller()->current_screen()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 static void QuitUIMessageLoop() { | 58 static void QuitUIMessageLoop() { |
| 59 MessageLoopForUI::current()->Quit(); | 59 MessageLoopForUI::current()->Quit(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 static bool inspector_called = false; // had to use global flag as | 62 static bool inspector_called = false; // had to use global flag as |
| 63 // InspectorHook() doesn't have context. | 63 // InspectorHook() doesn't have context. |
| 64 | 64 |
| 65 static URLRequestJob* InspectorHook(net::URLRequest* request, | 65 static net::URLRequestJob* InspectorHook(net::URLRequest* request, |
| 66 const std::string& scheme) { | 66 const std::string& scheme) { |
| 67 VLOG(1) << "Intercepted: " << request->url() << ", scheme: " << scheme; | 67 VLOG(1) << "Intercepted: " << request->url() << ", scheme: " << scheme; |
| 68 | 68 |
| 69 // Expect that the parameters are the same as new_account.html gave us. | 69 // Expect that the parameters are the same as new_account.html gave us. |
| 70 EXPECT_STREQ("cros://inspector/?param1=value1+param2", | 70 EXPECT_STREQ("cros://inspector/?param1=value1+param2", |
| 71 request->url().spec().c_str()); | 71 request->url().spec().c_str()); |
| 72 inspector_called = true; | 72 inspector_called = true; |
| 73 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 73 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 74 NewRunnableFunction(QuitUIMessageLoop)); | 74 NewRunnableFunction(QuitUIMessageLoop)); |
| 75 | 75 |
| 76 // Do not navigate to the given URL. Navigate to about:blank instead. | 76 // Do not navigate to the given URL. Navigate to about:blank instead. |
| 77 return new URLRequestAboutJob(request); | 77 return new URLRequestAboutJob(request); |
| 78 } | 78 } |
| 79 | 79 |
| 80 // Sometimes times out: http://crbug.com/60050. | 80 // Sometimes times out: http://crbug.com/60050. |
| 81 IN_PROC_BROWSER_TEST_F(AccountScreenTest, DISABLED_TestSchemeInspector) { | 81 IN_PROC_BROWSER_TEST_F(AccountScreenTest, DISABLED_TestSchemeInspector) { |
| 82 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( | 82 ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme( |
| 83 chrome::kCrosScheme); | 83 chrome::kCrosScheme); |
| 84 URLRequestFilter::GetInstance()->AddHostnameHandler(chrome::kCrosScheme, | 84 URLRequestFilter::GetInstance()->AddHostnameHandler(chrome::kCrosScheme, |
| 85 "inspector", | 85 "inspector", |
| 86 &InspectorHook); | 86 &InspectorHook); |
| 87 EXPECT_FALSE(inspector_called); | 87 EXPECT_FALSE(inspector_called); |
| 88 ui_test_utils::RunMessageLoop(); | 88 ui_test_utils::RunMessageLoop(); |
| 89 EXPECT_TRUE(inspector_called); | 89 EXPECT_TRUE(inspector_called); |
| 90 } | 90 } |
| 91 | 91 |
| 92 } // namespace chromeos | 92 } // namespace chromeos |
| OLD | NEW |