| OLD | NEW |
| (Empty) |
| 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 "chrome/test/automation/automation_proxy.h" | |
| 6 #include "chrome/test/automation/browser_proxy.h" | |
| 7 #include "chrome/test/automation/extension_proxy.h" | |
| 8 #include "chrome/test/automation/tab_proxy.h" | |
| 9 #include "chrome/test/ui/ui_test.h" | |
| 10 #include "net/test/test_server.h" | |
| 11 | |
| 12 class InfoBarsUITest : public UITest { | |
| 13 public: | |
| 14 InfoBarsUITest() { | |
| 15 show_window_ = true; | |
| 16 } | |
| 17 }; | |
| 18 | |
| 19 TEST_F(InfoBarsUITest, TestInfoBarsCloseOnNewTheme) { | |
| 20 net::TestServer test_server(net::TestServer::TYPE_HTTP, | |
| 21 net::TestServer::kLocalhost, | |
| 22 FilePath(FILE_PATH_LITERAL("chrome/test/data"))); | |
| 23 ASSERT_TRUE(test_server.Start()); | |
| 24 | |
| 25 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); | |
| 26 ASSERT_TRUE(browser.get()); | |
| 27 | |
| 28 scoped_refptr<TabProxy> tab_1(browser->GetActiveTab()); | |
| 29 ASSERT_TRUE(tab_1.get()); | |
| 30 EXPECT_TRUE(tab_1->NavigateToURL( | |
| 31 test_server.GetURL("files/simple.html"))); | |
| 32 scoped_refptr<ExtensionProxy> theme = automation()->InstallExtension( | |
| 33 test_data_directory_.AppendASCII("extensions").AppendASCII("theme.crx"), | |
| 34 true); | |
| 35 ASSERT_TRUE(theme != NULL); | |
| 36 EXPECT_TRUE(tab_1->WaitForInfoBarCount(1)); | |
| 37 | |
| 38 EXPECT_TRUE(browser->AppendTab( | |
| 39 test_server.GetURL("files/simple.html"))); | |
| 40 WaitUntilTabCount(2); | |
| 41 scoped_refptr<TabProxy> tab_2(browser->GetActiveTab()); | |
| 42 ASSERT_TRUE(tab_2.get()); | |
| 43 theme = automation()->InstallExtension( | |
| 44 test_data_directory_.AppendASCII("extensions").AppendASCII("theme2.crx"), | |
| 45 true); | |
| 46 ASSERT_TRUE(theme != NULL); | |
| 47 EXPECT_TRUE(tab_2->WaitForInfoBarCount(1)); | |
| 48 EXPECT_TRUE(tab_1->WaitForInfoBarCount(0)); | |
| 49 | |
| 50 EXPECT_TRUE(automation()->ResetToDefaultTheme()); | |
| 51 EXPECT_TRUE(tab_2->WaitForInfoBarCount(0)); | |
| 52 } | |
| OLD | NEW |