| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/scoped_temp_dir.h" | 8 #include "base/scoped_temp_dir.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "sql/connection.h" | 10 #include "sql/connection.h" |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 for (int i = 0; i < kNumNamespaces; ++i) { | 783 for (int i = 0; i < kNumNamespaces; ++i) { |
| 784 GURL namespace_url( | 784 GURL namespace_url( |
| 785 kMockOrigin.Resolve(base::StringPrintf(kNamespaceUrlFormat, i))); | 785 kMockOrigin.Resolve(base::StringPrintf(kNamespaceUrlFormat, i))); |
| 786 GURL target_url( | 786 GURL target_url( |
| 787 kMockOrigin.Resolve(base::StringPrintf(kTargetUrlFormat, i))); | 787 kMockOrigin.Resolve(base::StringPrintf(kTargetUrlFormat, i))); |
| 788 statement.BindInt64(0, i); | 788 statement.BindInt64(0, i); |
| 789 statement.BindString(1, kMockOrigin.spec().c_str()); | 789 statement.BindString(1, kMockOrigin.spec().c_str()); |
| 790 statement.BindString(2, namespace_url.spec().c_str()); | 790 statement.BindString(2, namespace_url.spec().c_str()); |
| 791 statement.BindString(3, target_url.spec().c_str()); | 791 statement.BindString(3, target_url.spec().c_str()); |
| 792 ASSERT_TRUE(statement.Run()); | 792 ASSERT_TRUE(statement.Run()); |
| 793 statement.Reset(); | 793 statement.Reset(true); |
| 794 } | 794 } |
| 795 | 795 |
| 796 EXPECT_TRUE(transaction.Commit()); | 796 EXPECT_TRUE(transaction.Commit()); |
| 797 } | 797 } |
| 798 | 798 |
| 799 // Open that database and verify that it got updated. | 799 // Open that database and verify that it got updated. |
| 800 AppCacheDatabase db(kDbFile); | 800 AppCacheDatabase db(kDbFile); |
| 801 EXPECT_TRUE(db.LazyOpen(true)); | 801 EXPECT_TRUE(db.LazyOpen(true)); |
| 802 | 802 |
| 803 EXPECT_FALSE(db.db_->DoesTableExist("FallbackNameSpaces")); | 803 EXPECT_FALSE(db.db_->DoesTableExist("FallbackNameSpaces")); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 828 | 828 |
| 829 EXPECT_EQ(i, fallbacks[i].cache_id); | 829 EXPECT_EQ(i, fallbacks[i].cache_id); |
| 830 EXPECT_EQ(FALLBACK_NAMESPACE, fallbacks[i].type); | 830 EXPECT_EQ(FALLBACK_NAMESPACE, fallbacks[i].type); |
| 831 EXPECT_EQ(kMockOrigin, fallbacks[i].origin); | 831 EXPECT_EQ(kMockOrigin, fallbacks[i].origin); |
| 832 EXPECT_EQ(expected_namespace_url, fallbacks[i].namespace_url); | 832 EXPECT_EQ(expected_namespace_url, fallbacks[i].namespace_url); |
| 833 EXPECT_EQ(expected_target_url, fallbacks[i].target_url); | 833 EXPECT_EQ(expected_target_url, fallbacks[i].target_url); |
| 834 } | 834 } |
| 835 } | 835 } |
| 836 | 836 |
| 837 } // namespace appcache | 837 } // namespace appcache |
| OLD | NEW |