OLD | NEW |
1 // Copyright (c) 2011 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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "chrome/browser/browser_about_handler.h" | 8 #include "chrome/browser/browser_about_handler.h" |
9 #include "chrome/common/url_constants.h" | 9 #include "chrome/common/url_constants.h" |
10 #include "chrome/test/base/testing_profile.h" | 10 #include "chrome/test/base/testing_profile.h" |
11 #include "content/test/test_browser_thread.h" | 11 #include "content/test/test_browser_thread.h" |
12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
14 | 14 |
15 using content::BrowserThread; | 15 using content::BrowserThread; |
16 | 16 |
17 typedef testing::Test BrowserAboutHandlerTest; | 17 typedef testing::Test BrowserAboutHandlerTest; |
18 | 18 |
19 TEST_F(BrowserAboutHandlerTest, WillHandleBrowserAboutURL) { | 19 TEST_F(BrowserAboutHandlerTest, WillHandleBrowserAboutURL) { |
20 std::string chrome_prefix(chrome::kChromeUIScheme); | 20 std::string chrome_prefix(chrome::kChromeUIScheme); |
21 chrome_prefix.append(chrome::kStandardSchemeSeparator); | 21 chrome_prefix.append(content::kStandardSchemeSeparator); |
22 struct AboutURLTestData { | 22 struct AboutURLTestData { |
23 GURL test_url; | 23 GURL test_url; |
24 GURL result_url; | 24 GURL result_url; |
25 } test_data[] = { | 25 } test_data[] = { |
26 { | 26 { |
27 GURL("http://google.com"), | 27 GURL("http://google.com"), |
28 GURL("http://google.com") | 28 GURL("http://google.com") |
29 }, | 29 }, |
30 { | 30 { |
31 GURL(chrome::kAboutBlankURL), | 31 GURL(chrome::kAboutBlankURL), |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 MessageLoopForUI message_loop; | 63 MessageLoopForUI message_loop; |
64 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); | 64 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); |
65 TestingProfile profile; | 65 TestingProfile profile; |
66 | 66 |
67 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { | 67 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { |
68 GURL url(test_data[i].test_url); | 68 GURL url(test_data[i].test_url); |
69 WillHandleBrowserAboutURL(&url, &profile); | 69 WillHandleBrowserAboutURL(&url, &profile); |
70 EXPECT_EQ(test_data[i].result_url, url); | 70 EXPECT_EQ(test_data[i].result_url, url); |
71 } | 71 } |
72 } | 72 } |
OLD | NEW |