| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/path_service.h" | 5 #include "base/path_service.h" |
| 6 #include "base/ref_counted.h" | 6 #include "base/ref_counted.h" |
| 7 #include "base/utf_string_conversions.h" |
| 7 #include "chrome/common/chrome_paths.h" | 8 #include "chrome/common/chrome_paths.h" |
| 8 #include "chrome/test/automation/automation_proxy.h" | 9 #include "chrome/test/automation/automation_proxy.h" |
| 9 #include "chrome/test/automation/browser_proxy.h" | 10 #include "chrome/test/automation/browser_proxy.h" |
| 10 #include "chrome/test/automation/extension_proxy.h" | 11 #include "chrome/test/automation/extension_proxy.h" |
| 11 #include "chrome/test/automation/tab_proxy.h" | 12 #include "chrome/test/automation/tab_proxy.h" |
| 12 #include "chrome/test/ui/ui_test.h" | 13 #include "chrome/test/ui/ui_test.h" |
| 13 | 14 |
| 14 namespace { | 15 namespace { |
| 15 | 16 |
| 16 // These tests are not meant to test the extension system itself, but to verify | 17 // These tests are not meant to test the extension system itself, but to verify |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 NavigateToURL(localhost); | 115 NavigateToURL(localhost); |
| 115 | 116 |
| 116 // Click the browser action, which should rename the tab title to | 117 // Click the browser action, which should rename the tab title to |
| 117 // the tab's index. | 118 // the tab's index. |
| 118 ASSERT_TRUE(rename_tab_extension-> | 119 ASSERT_TRUE(rename_tab_extension-> |
| 119 ExecuteActionInActiveTabAsync(browser.get())); | 120 ExecuteActionInActiveTabAsync(browser.get())); |
| 120 ASSERT_NO_FATAL_FAILURE(automation()->EnsureExtensionTestResult()); | 121 ASSERT_NO_FATAL_FAILURE(automation()->EnsureExtensionTestResult()); |
| 121 | 122 |
| 122 scoped_refptr<TabProxy> display_tab = browser->GetTab(0); | 123 scoped_refptr<TabProxy> display_tab = browser->GetTab(0); |
| 123 ASSERT_TRUE(display_tab); | 124 ASSERT_TRUE(display_tab); |
| 124 std::wstring title_wstring; | 125 string16 title_string; |
| 125 ASSERT_TRUE(display_tab->GetTabTitle(&title_wstring)); | 126 ASSERT_TRUE(display_tab->GetTabTitle(&title_string)); |
| 126 ASSERT_STREQ(L"0", title_wstring.c_str()); | 127 ASSERT_EQ(ASCIIToUTF16("0"), title_string); |
| 127 | 128 |
| 128 // Click the action again right after navigating to a new page. | 129 // Click the action again right after navigating to a new page. |
| 129 ASSERT_TRUE(browser->AppendTab(localhost)); | 130 ASSERT_TRUE(browser->AppendTab(localhost)); |
| 130 display_tab = browser->GetTab(1); | 131 display_tab = browser->GetTab(1); |
| 131 ASSERT_TRUE(display_tab); | 132 ASSERT_TRUE(display_tab); |
| 132 ASSERT_TRUE(rename_tab_extension-> | 133 ASSERT_TRUE(rename_tab_extension-> |
| 133 ExecuteActionInActiveTabAsync(browser.get())); | 134 ExecuteActionInActiveTabAsync(browser.get())); |
| 134 ASSERT_NO_FATAL_FAILURE(automation()->EnsureExtensionTestResult()); | 135 ASSERT_NO_FATAL_FAILURE(automation()->EnsureExtensionTestResult()); |
| 135 ASSERT_TRUE(display_tab->GetTabTitle(&title_wstring)); | 136 ASSERT_TRUE(display_tab->GetTabTitle(&title_string)); |
| 136 ASSERT_STREQ(L"1", title_wstring.c_str()); | 137 ASSERT_EQ(ASCIIToUTF16("1"), title_string); |
| 137 | 138 |
| 138 // Do not forget to stop the server. | 139 // Do not forget to stop the server. |
| 139 StopHttpServer(); | 140 StopHttpServer(); |
| 140 } | 141 } |
| 141 | 142 |
| 142 // Flaky, http://crbug.com/59441. | 143 // Flaky, http://crbug.com/59441. |
| 143 TEST_F(ExtensionProxyUITest, FLAKY_MoveBrowserAction) { | 144 TEST_F(ExtensionProxyUITest, FLAKY_MoveBrowserAction) { |
| 144 scoped_refptr<ExtensionProxy> rename_tab_extension = | 145 scoped_refptr<ExtensionProxy> rename_tab_extension = |
| 145 InstallRenameTabExtension(); | 146 InstallRenameTabExtension(); |
| 146 ASSERT_TRUE(rename_tab_extension.get()); | 147 ASSERT_TRUE(rename_tab_extension.get()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 172 EnsureIdMatches("aiglobglfckejlcpcbdokbkbjeemfhno")); | 173 EnsureIdMatches("aiglobglfckejlcpcbdokbkbjeemfhno")); |
| 173 ASSERT_NO_FATAL_FAILURE(simple_extension_-> | 174 ASSERT_NO_FATAL_FAILURE(simple_extension_-> |
| 174 EnsureNameMatches("Browser Action")); | 175 EnsureNameMatches("Browser Action")); |
| 175 ASSERT_NO_FATAL_FAILURE(simple_extension_-> | 176 ASSERT_NO_FATAL_FAILURE(simple_extension_-> |
| 176 EnsureVersionMatches("0.1.1")); | 177 EnsureVersionMatches("0.1.1")); |
| 177 ASSERT_NO_FATAL_FAILURE(simple_extension_-> | 178 ASSERT_NO_FATAL_FAILURE(simple_extension_-> |
| 178 EnsureBrowserActionIndexMatches(0)); | 179 EnsureBrowserActionIndexMatches(0)); |
| 179 } | 180 } |
| 180 | 181 |
| 181 } // namespace | 182 } // namespace |
| OLD | NEW |