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 3 // found in the LICENSE file. 4 5 #include "base/base_switches.h" 6 #include "base/command_line.h" 7 #include "base/prefs/pref_service.h" 8 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/common/pref_names.h" 11 #include "net/dns/mock_host_resolver.h" 12 13 namespace extensions { 14 15 class HistoryApiTest : public ExtensionApiTest { 16 public: 17 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 18 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); 19 20 host_resolver()->AddRule("www.a.com", "127.0.0.1"); 21 host_resolver()->AddRule("www.b.com", "127.0.0.1"); 22 } 23 }; 24 25 // Full text search indexing sometimes exceeds a timeout. (http://crbug/119505) 26 IN_PROC_BROWSER_TEST_F(HistoryApiTest, DISABLED_MiscSearch) { 27 ASSERT_TRUE(StartEmbeddedTestServer()); 28 ASSERT_TRUE(RunExtensionSubtest("history", "misc_search.html")) << message_; 29 } 30 31 // Same could happen here without the FTS (http://crbug/119505) 32 IN_PROC_BROWSER_TEST_F(HistoryApiTest, DISABLED_TimedSearch) { 33 ASSERT_TRUE(StartEmbeddedTestServer()); 34 ASSERT_TRUE(RunExtensionSubtest("history", "timed_search.html")) << message_; 35 } 36 37 #if defined(OS_WIN) 38 // Flaky on Windows: crbug.com/88318 39 #define MAYBE_Delete DISABLED_Delete 40 #else 41 #define MAYBE_Delete Delete 42 #endif 43 IN_PROC_BROWSER_TEST_F(HistoryApiTest, MAYBE_Delete) { 44 ASSERT_TRUE(StartEmbeddedTestServer()); 45 ASSERT_TRUE(RunExtensionSubtest("history", "delete.html")) << message_; 46 } 47 48 IN_PROC_BROWSER_TEST_F(HistoryApiTest, DeleteProhibited) { 49 browser()->profile()->GetPrefs()-> 50 SetBoolean(prefs::kAllowDeletingBrowserHistory, false); 51 ASSERT_TRUE(StartEmbeddedTestServer()); 52 ASSERT_TRUE(RunExtensionSubtest("history", "delete_prohibited.html")) << 53 message_; 54 } 55 56 // See crbug.com/79074 57 IN_PROC_BROWSER_TEST_F(HistoryApiTest, DISABLED_GetVisits) { 58 ASSERT_TRUE(StartEmbeddedTestServer()); 59 ASSERT_TRUE(RunExtensionSubtest("history", "get_visits.html")) << message_; 60 } 61 62 #if defined(OS_WIN) 63 // Searching for a URL right after adding it fails on win XP. 64 // Fix this as part of crbug/76170. 65 #define MAYBE_SearchAfterAdd DISABLED_SearchAfterAdd 66 #else 67 #define MAYBE_SearchAfterAdd SearchAfterAdd 68 #endif 69 70 IN_PROC_BROWSER_TEST_F(HistoryApiTest, MAYBE_SearchAfterAdd) { 71 ASSERT_TRUE(StartEmbeddedTestServer()); 72 ASSERT_TRUE(RunExtensionSubtest("history", "search_after_add.html")) 73 << message_; 74 } 75 76 } // namespace extensions 77