| 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 "chrome/browser/extensions/webstore_inline_installer.h" | 5 #include "chrome/browser/extensions/webstore_inline_installer.h" |
| 6 #include "googleurl/src/gurl.h" | 6 #include "googleurl/src/gurl.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 | 8 |
| 9 namespace extensions { |
| 10 |
| 9 // A macro, so that the IsRequestorURLInVerifiedSite calls are inside of the | 11 // A macro, so that the IsRequestorURLInVerifiedSite calls are inside of the |
| 10 // the test, which is marked as a friend of WebstoreInlineInstaller. | 12 // the test, which is marked as a friend of WebstoreInlineInstaller. |
| 11 #define IsVerified(requestor_url, verified_site) \ | 13 #define IsVerified(requestor_url, verified_site) \ |
| 12 WebstoreInlineInstaller::IsRequestorURLInVerifiedSite( \ | 14 WebstoreInlineInstaller::IsRequestorURLInVerifiedSite( \ |
| 13 GURL(requestor_url), verified_site) | 15 GURL(requestor_url), verified_site) |
| 14 | 16 |
| 15 TEST(WebstoreInlineInstallerTest, DomainVerification) { | 17 TEST(WebstoreInlineInstallerTest, DomainVerification) { |
| 16 // Exact domain match. | 18 // Exact domain match. |
| 17 EXPECT_TRUE(IsVerified("http://example.com", "example.com")); | 19 EXPECT_TRUE(IsVerified("http://example.com", "example.com")); |
| 18 | 20 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 EXPECT_TRUE(IsVerified("http://example.com/path/", "example.com/path")); | 64 EXPECT_TRUE(IsVerified("http://example.com/path/", "example.com/path")); |
| 63 | 65 |
| 64 // Path matches (is a file under the path). | 66 // Path matches (is a file under the path). |
| 65 EXPECT_TRUE(IsVerified( | 67 EXPECT_TRUE(IsVerified( |
| 66 "http://example.com/path/page.html", "example.com/path")); | 68 "http://example.com/path/page.html", "example.com/path")); |
| 67 | 69 |
| 68 // Path and port match. | 70 // Path and port match. |
| 69 EXPECT_TRUE(IsVerified( | 71 EXPECT_TRUE(IsVerified( |
| 70 "http://example.com:123/path/page.html", "example.com:123/path")); | 72 "http://example.com:123/path/page.html", "example.com:123/path")); |
| 71 } | 73 } |
| 74 |
| 75 } // namespace extensions |
| OLD | NEW |