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 "chrome/browser/extensions/api/identity/web_auth_flow.h" | 6 #include "chrome/browser/extensions/api/identity/web_auth_flow.h" |
7 #include "chrome/browser/ui/extensions/web_auth_flow_window.h" | 7 #include "chrome/browser/ui/extensions/web_auth_flow_window.h" |
8 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 8 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
9 #include "chrome/test/base/testing_profile.h" | 9 #include "chrome/test/base/testing_profile.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 class WebAuthFlowTest : public ChromeRenderViewHostTestHarness { | 98 class WebAuthFlowTest : public ChromeRenderViewHostTestHarness { |
99 protected: | 99 protected: |
100 WebAuthFlowTest() | 100 WebAuthFlowTest() |
101 : thread_(BrowserThread::UI, &message_loop_) { | 101 : thread_(BrowserThread::UI, &message_loop_) { |
102 } | 102 } |
103 | 103 |
104 virtual void SetUp() { | 104 virtual void SetUp() { |
105 ChromeRenderViewHostTestHarness::SetUp(); | 105 ChromeRenderViewHostTestHarness::SetUp(); |
106 } | 106 } |
107 | 107 |
| 108 virtual void TearDown() { |
| 109 // |flow_| must be reset before ChromeRenderViewHostTestHarness::TearDown(), |
| 110 // because |flow_| deletes the WebContents it owns via |
| 111 // MessageLoop::DeleteSoon(). |
| 112 flow_.reset(); |
| 113 ChromeRenderViewHostTestHarness::TearDown(); |
| 114 } |
| 115 |
108 void CreateAuthFlow(const std::string& extension_id, const GURL& url) { | 116 void CreateAuthFlow(const std::string& extension_id, const GURL& url) { |
109 flow_.reset(new MockWebAuthFlow(&delegate_, profile(), extension_id, url)); | 117 flow_.reset(new MockWebAuthFlow(&delegate_, profile(), extension_id, url)); |
110 } | 118 } |
111 | 119 |
112 MockWebAuthFlow& flow() { | 120 MockWebAuthFlow& flow() { |
113 return *flow_.get(); | 121 return *flow_.get(); |
114 } | 122 } |
115 | 123 |
116 WebAuthFlow* flow_base() { | 124 WebAuthFlow* flow_base() { |
117 return flow_.get(); | 125 return flow_.get(); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 // http scheme is not allowed. | 208 // http scheme is not allowed. |
201 EXPECT_FALSE(CallIsValidRedirectUrl( | 209 EXPECT_FALSE(CallIsValidRedirectUrl( |
202 GURL("http://abcdefghij.chromiumapp.org/callback"))); | 210 GURL("http://abcdefghij.chromiumapp.org/callback"))); |
203 EXPECT_FALSE(CallIsValidRedirectUrl( | 211 EXPECT_FALSE(CallIsValidRedirectUrl( |
204 GURL("https://abcd.chromiumapp.org/callback"))); | 212 GURL("https://abcd.chromiumapp.org/callback"))); |
205 EXPECT_FALSE(CallIsValidRedirectUrl( | 213 EXPECT_FALSE(CallIsValidRedirectUrl( |
206 GURL("chrome-extension://abcd/callback"))); | 214 GURL("chrome-extension://abcd/callback"))); |
207 EXPECT_FALSE(CallIsValidRedirectUrl( | 215 EXPECT_FALSE(CallIsValidRedirectUrl( |
208 GURL("chrome-extension://abcdefghijkl/"))); | 216 GURL("chrome-extension://abcdefghijkl/"))); |
209 } | 217 } |
OLD | NEW |