| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 8264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8275 | 8275 |
| 8276 EXPECT_TRUE(resource); | 8276 EXPECT_TRUE(resource); |
| 8277 EXPECT_NE(0, resource->loadFinishTime()); | 8277 EXPECT_NE(0, resource->loadFinishTime()); |
| 8278 | 8278 |
| 8279 DocumentLoader* loader = document->loader(); | 8279 DocumentLoader* loader = document->loader(); |
| 8280 | 8280 |
| 8281 EXPECT_TRUE(loader); | 8281 EXPECT_TRUE(loader); |
| 8282 EXPECT_EQ(loader->timing().responseEnd(), resource->loadFinishTime()); | 8282 EXPECT_EQ(loader->timing().responseEnd(), resource->loadFinishTime()); |
| 8283 } | 8283 } |
| 8284 | 8284 |
| 8285 class CallbackOrderingWebFrameClient : public FrameTestHelpers::TestWebFrameClie
nt { |
| 8286 public: |
| 8287 CallbackOrderingWebFrameClient() : m_callbackCount(0) { } |
| 8288 |
| 8289 void didStartLoading(bool toDifferentDocument) override |
| 8290 { |
| 8291 EXPECT_EQ(0, m_callbackCount++); |
| 8292 FrameTestHelpers::TestWebFrameClient::didStartLoading(toDifferentDocumen
t); |
| 8293 } |
| 8294 void didStartProvisionalLoad(WebLocalFrame*, double) override { EXPECT_EQ(1,
m_callbackCount++); } |
| 8295 void didCommitProvisionalLoad(WebLocalFrame*, const WebHistoryItem&, WebHist
oryCommitType) override { EXPECT_EQ(2, m_callbackCount++); } |
| 8296 void didFinishDocumentLoad(WebLocalFrame*, bool documentIsEmpty) override {
EXPECT_EQ(3, m_callbackCount++); } |
| 8297 void didHandleOnloadEvents(WebLocalFrame*) override { EXPECT_EQ(4, m_callbac
kCount++); } |
| 8298 void didFinishLoad(WebLocalFrame*) override { EXPECT_EQ(5, m_callbackCount++
); } |
| 8299 void didStopLoading() override |
| 8300 { |
| 8301 EXPECT_EQ(6, m_callbackCount++); |
| 8302 FrameTestHelpers::TestWebFrameClient::didStopLoading(); |
| 8303 } |
| 8304 |
| 8305 private: |
| 8306 int m_callbackCount; |
| 8307 }; |
| 8308 |
| 8309 TEST_F(WebFrameTest, CallbackOrdering) |
| 8310 { |
| 8311 registerMockedHttpURLLoad("foo.html"); |
| 8312 FrameTestHelpers::WebViewHelper webViewHelper; |
| 8313 CallbackOrderingWebFrameClient client; |
| 8314 webViewHelper.initializeAndLoad(m_baseURL + "foo.html", true, &client); |
| 8315 } |
| 8316 |
| 8285 } // namespace blink | 8317 } // namespace blink |
| OLD | NEW |