OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/renderer/chrome_render_frame_observer.h" | 5 #include "chrome/renderer/chrome_render_frame_observer.h" |
6 | 6 |
7 #include <tuple> | 7 #include <tuple> |
8 | 8 |
| 9 #include "base/run_loop.h" |
9 #include "base/test/histogram_tester.h" | 10 #include "base/test/histogram_tester.h" |
10 #include "chrome/test/base/chrome_render_view_test.h" | 11 #include "chrome/test/base/chrome_render_view_test.h" |
11 #include "components/translate/content/common/translate.mojom.h" | 12 #include "components/translate/content/common/translate.mojom.h" |
12 #include "components/translate/content/renderer/translate_helper.h" | 13 #include "components/translate/content/renderer/translate_helper.h" |
13 #include "components/translate/core/common/translate_constants.h" | 14 #include "components/translate/core/common/translate_constants.h" |
14 #include "content/public/renderer/render_frame.h" | 15 #include "content/public/renderer/render_frame.h" |
15 #include "content/public/renderer/render_view.h" | 16 #include "content/public/renderer/render_view.h" |
16 #include "mojo/public/cpp/bindings/binding_set.h" | 17 #include "mojo/public/cpp/bindings/binding_set.h" |
17 #include "services/service_manager/public/cpp/interface_provider.h" | 18 #include "services/service_manager/public/cpp/interface_provider.h" |
18 #include "third_party/WebKit/public/web/WebView.h" | 19 #include "third_party/WebKit/public/web/WebView.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 view_->GetWebView()->updateAllLifecyclePhases(); | 80 view_->GetWebView()->updateAllLifecyclePhases(); |
80 | 81 |
81 base::RunLoop().RunUntilIdle(); | 82 base::RunLoop().RunUntilIdle(); |
82 ASSERT_TRUE(fake_translate_driver_.called_new_page_); | 83 ASSERT_TRUE(fake_translate_driver_.called_new_page_); |
83 EXPECT_TRUE(fake_translate_driver_.page_needs_translation_) | 84 EXPECT_TRUE(fake_translate_driver_.page_needs_translation_) |
84 << "Page should be translatable."; | 85 << "Page should be translatable."; |
85 // Should have 2 samples: one for preliminary capture, one for final capture. | 86 // Should have 2 samples: one for preliminary capture, one for final capture. |
86 // If there are more, then subframes are being captured more than once. | 87 // If there are more, then subframes are being captured more than once. |
87 histogram_tester.ExpectTotalCount(kTranslateCaptureText, 2); | 88 histogram_tester.ExpectTotalCount(kTranslateCaptureText, 2); |
88 } | 89 } |
OLD | NEW |